-
Notifications
You must be signed in to change notification settings - Fork 0
/
annoying papple.py
290 lines (263 loc) · 9.88 KB
/
annoying papple.py
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# Install dependencies
def install (name):
subprocess.call(['pip', 'install', name])
import discord
import os
import random
import subprocess
import wikipedia
from discord.ext import commands
from googletrans import Translator
from keep_alive import keep_alive
from PyDictionary import PyDictionary
install('googletrans==3.1.0a0')
# Initialize dependencies
client = commands.Bot(command_prefix = ".", help_command=None)
translator = Translator()
dictionary = PyDictionary()
# Activate bot
@client.event
async def on_ready():
await client.change_presence(status=discord.Status.online, activity=discord.Game('.help'))
print("We're Golden!")
# Dead Chat Gif List
deadchatgif = [
"https://tenor.com/view/dead-chat-gif-18800792",
"https://tenor.com/view/googas-wet-wet-cat-dead-chat-dead-chat-xd-gif-20820186",
"https://tenor.com/view/rip-chat-chat-dead-dead-chat-inactive-gif-18754855",
"https://tenor.com/view/the-dancing-dorito-i-revive-this-chat-dance-gif-14308244",
"https://tenor.com/view/chat-dead-gif-18627672",
"https://tenor.com/view/dead-chat-xd-discord-cry-sad-gif-19674247",
"https://tenor.com/view/cringe-dead-chat-kermit-wtf-gif-20484958",
"https://tenor.com/view/chats-dead-dead-chat-gif-15061736",
"https://tenor.com/view/chat-dead-gif-19569291",
"https://tenor.com/view/dead-chat-dead-chat-xd-alohadance-gif-20439881",
"https://tenor.com/view/damianek-dead-chat-gif-19862880",
"https://tenor.com/view/dead-chat-african-black-guy-laughing-discord-gif-20391612",
"https://tenor.com/view/wtf-dead-chat-cringe-discord-cry-gif-20805838",
"https://tenor.com/view/dead-chat-gif-20589759",
"https://tenor.com/view/dead-chat-dead-chat-wtf-dies-of-cringe-gif-20364592",
"https://tenor.com/view/dead-chat-gif-20130964"
]
# 8 Ball Responses List
responses = ["It is certain.",
"It is decidedly so.",
"Without a doubt.",
"Yes - definitely.",
"You may rely on it.",
"As I see it, yes.",
"Most likely.",
"Outlook good.",
"Yes.",
"Signs point to yes.",
"Reply hazy, try again.",
"Ask again later.",
"Better not tell you now.",
"Cannot predict now.",
"Concentrate and ask again.",
"Don't count on it.",
"My reply is no.",
"My sources say no.",
"Outlook not so good.",
"Very doubtful."]
# Opinions list
opinions = [
"My favourite",
"Not the best",
"Greatest of all time",
"Completely ovverated",
"I've seen better",
"Simply exquisite",
"Terrible",
"Debateable",
"Worst thing I've heard of today"]
# 8ball Command
@client.command(aliases=['8ball', 'test'])
async def _8ball(ctx, *, question):
await ctx.send(f'Question: {question}\nAnswer: {random.choice(responses)}')
# Calculator Command
@client.command(alisases = ["calculate"])
async def calc(ctx, *, content):
con = (content.translate({ord(" "): None}))
x = "x"
try:
if x in con:
con = con.replace(x,"*")
result = eval(con)
await ctx.send(f"```{content} = {str(result)}```")
except ZeroDivisionError:
await ctx.send("Sorry but you can't divide by zero ¯\_(ツ)_/¯")
# Calculator Help Command
@client.command(alises=["calch", "calculator_help"])
async def calchelp(ctx):
embed = discord.Embed(
title = "Calculator Command",
description = """**Calculate** : ``[.calc "number" "operation" "number"...]``\n\n**Operations** :\nAdditon : ``+``\nSubtraction : ``-``\nMultiplaction : ``x``\nDivision : ``/``\nExponentiation : ``**`` """,
color = discord.Colour.green())
await ctx.send(embed=embed)
# Clear Command
@client.command()
@commands.has_permissions(manage_messages=True)
async def clear(ctx, limit, member: discord.Member=None):
await ctx.message.delete()
msg = []
try:
limit = int(limit)
except:
return await ctx.send("Please pass in an integer as limit")
if not member:
await ctx.channel.purge(limit=limit)
return await ctx.send(f"Purged {limit} messages", delete_after=3)
async for m in ctx.channel.history():
if len(msg) == limit:
break
if m.author == member:
msg.append(m)
await ctx.channel.delete_messages(msg)
await ctx.send(f"Purged {limit} messages of {member.mention}", delete_after=3)
# Coin Flip Command
@client.command(aliases=["flip"])
async def flip_coin(ctx):
coin = ["```Heads```", "```Tails```"]
await ctx.send(str(random.choice(coin)))
# Dead Chat Gif Sender
@client.listen('on_message')
async def dead_chat(message):
dead_chats = ["dead chat", "Dead chat", "DEAD CHAT", "Dead Chat"]
already_sent = False
if already_sent == False:
for word in dead_chats:
if word in message.content:
already_sent = True
await message.channel.send(random.choice(deadchatgif))
break
already_sent = False
# Dice Roll Command
@client.command(aliases=["roll"])
async def roll_dice(ctx):
val = (random.randint(1, 6))
await ctx.send(f"```{val}```")
# Dictionary Antonym Command
@client.command(aliases=["antonym", "opposite"])
async def ant(ctx, arg1):
word = (str(arg1))
sentence = (dictionary.antonym(word))
embed = discord.Embed(
title = f"{arg1}",
description = f"```{(str(sentence)[1:-1])}```",
color = discord.Colour.red())
await ctx.send(embed=embed)
# Dictionary Help Command
@client.command(aliases=["dictionaryhelp"])
async def dicthelp(ctx):
embed = discord.Embed(
title = "Dictionary Commands",
description = """\n\n**Meaning** : ``[.mean "word"]``\n\n**Synonym** : ``[.syn "word"]``\n\n**Antonym** : ``[.ant "word"]``\n\n**Translate** : ``[.trans "language code" "message"]``""",
color = discord.Colour.red())
await ctx.send(embed=embed)
# Dictionary Meaning Command
@client.command(aliases=["meaning", "define", "def"])
async def mean(ctx, arg1):
word = (str(arg1))
sentence = (dictionary.meaning(word))
embed = discord.Embed(
title = f"{arg1}",
description = f"```{sentence}```",
color = discord.Colour.red())
await ctx.send(embed=embed)
# Dictionary Synonym Command
@client.command(aliases=["synonym", "like"])
async def syn(ctx, arg1):
word = (str(arg1))
sentence = (dictionary.synonym(word))
sen = (str(sentence)[1:-1])
embed = discord.Embed(
title = f"{arg1}",
description = f"""```{sen}```""",
color = discord.Colour.red())
await ctx.send(embed=embed)
# Dictionary Translate Command
@client.command(aliases=["translate", "trans"])
async def tra(ctx, lang, *, sentence):
translation = translator.translate(sentence, dest=lang)
embed = discord.Embed(
title = f"({translation.src}) --> ({translation.dest})",
description = (f"```Original: {translation.origin} ({translation.src})\n\nTranslation: {translation.text} ({translation.dest})```"),
color = discord.Colour.red())
await ctx.send(embed=embed)
# Hamburger Image Sender
@client.listen('on_message')
async def on_msg(message):
substring = "hamburger"
sub2 = "big mac"
fullstring = message.content
if substring in fullstring:
await message.channel.send(file=discord.File(r'hamburger.png'))
if sub2 in fullstring:
await message.channel.send(file=discord.File(r'hamburger.png'))
# Help Command
@client.command(aliases=["h"])
async def help(ctx):
embed = discord.Embed(
title = "Command Help",
description = """**Ask my opinion ** : ``[.op "something"]``
\n**Calculate some numbers** : ``[.calchelp]``
\n**Consult the 8ball** : ``[.8ball "question"]``
\n**Use a Dictionary** : ``[.dicthelp]``
\n**Flip a coin** : ``[.flip]``
\n**Random Number Generator** : ``[.rng "minimum" "maximum"]``
\n**Roll a die** : ``[.roll]``
\n**Send poll question** : ``[.poll "mentions" "topic"]``
\n**Search anything on Wikipedia** : ``[.search "topic"]``
\n**See the staff commands** : ``[.staffcommands]``""",
color = discord.Colour.blue())
await ctx.send(embed=embed)
# Meow Deleter
@client.listen('on_message')
async def on_msg2(message):
dalist = [736979328050659328, 658859052629098507]
blocked_words = ["meow", "Meow", "MEOW"]
if message.author.id in dalist:
for word in blocked_words:
if word in message.content:
await message.delete()
# Opinion Command
@client.command(aliases=["opinion"])
async def op(ctx, *, question):
await ctx.send(f'Question: {question}\nAnswer: {random.choice(opinions)}')
# Ping Command
@client.command()
async def ping(ctx):
await ctx.send(f"Pong! {round(client.latency * 1000)}ms")
# Poll Command
@client.command()
@commands.has_permissions(mention_everyone=True)
async def poll(ctx, mentions, *, message):
emb = discord.Embed(title=f"{message}",
color = discord.Colour.green())
msg=await ctx.channel.send(embed=emb)
await msg.add_reaction("👍")
await msg.add_reaction("👎")
await message.delete()
# Random Number Generator
@client.command(aliases=["rng"])
async def rand(ctx, minimum, maximum):
min = (int(minimum))
max = (int(maximum))
num = random.randint(min, max)
await ctx.send((str(num)))
# Wikipedia Search Command
@client.command(alisases = ["wiki"])
async def search(ctx, *, content):
try:
summary = wikipedia.summary(content, sentences=2)
embed = discord.Embed(
title = f"{content}",
description = f"""``{summary}``""",
color = discord.Colour.red())
await ctx.send(embed=embed)
except:
await ctx.send("Try re-wording that.")
# Keep Bot Alive
keep_alive()
client.run(os.getenv('TOKEN'))