-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGifCommands.py
More file actions
48 lines (31 loc) · 945 Bytes
/
GifCommands.py
File metadata and controls
48 lines (31 loc) · 945 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import random
temp = open('giflist.txt')
data = temp.readlines()
temp.close()
giflist = []
for line in data:
line = line.strip().split(': ',1)
giflist.append(line)
gifdict = {}
for entry in giflist:
gifdict[entry[0]] = entry[1]
commandlist = [['$gif [Name]', 'play a gif using its name'],['$gr','pull a random gif'],
['$list','get a link to all avalible gifs']]
#################################
def help():
output = ""
for entry in commandlist:
output += ('Use "%s" to %s! \n' % (entry[0],entry[1]))
return output
################################
def gifsearch(message):
output = ""
for entry in giflist:
if message.lower().strip() in entry[0].lower() :
output += entry[1]
if output == "" :
return ('Gif not found.')
return output
################################
def gifrandom():
return giflist[random.randint(0,len(giflist)-1)][1]