-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.py
381 lines (338 loc) · 10.7 KB
/
bot.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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
# This is the code for the Discord bot on my server, The Potato Kingdom.
# Requirements (pip install):
# discord.py, python-dotenv
# Also create a file called "token.txt" in the same directory as this file to run it using your own token
# (use the Discord developer portal to generate the token)
# And a file called "welcome.txt" which has the ID for the welcome channel in your test server (e.g. 724810199180771358)
# (turn on developer mode in settings, right click your #welcome channel and select Copy ID)
import os
import discord
from dotenv import load_dotenv
from discord.ext import commands
from discord.ext.commands import CommandNotFound
import random
load_dotenv()
f = open('token.txt', 'r')
token_thing = f.read()
f.close()
TOKEN = token_thing
bot = commands.Bot(command_prefix="!", intents=discord.Intents().all())
f = open('welcome.txt', 'r')
WELCOME_CHANNEL = f.read()
f.close()
def check_channel(ctx):
if ctx.channel.name == "bot-commands" or ctx.channel.name == "spam":
return True
else:
return False
@bot.event
async def on_ready():
print(f'{bot.user} has connected to Discord! Yeet')
await bot.change_presence(activity=discord.Game('return to potato'))
@bot.command(
help="Uses some crazy logic to determine if pong is actually the correct value or not.",
brief="Prints pong back to the channel."
)
async def ping(ctx):
await ctx.channel.send("Pong!")
@bot.command(
help="Eat it",
brief="Eat it"
)
async def potato(ctx):
stuff = ["You ate a potato! :potato:",
"You ate a sweet potato! :sweet_potato:",
"You ate a potato with a fork! :potato: :fork_and_knife:",
"You ate a potato with a spoon! :potato: :spoon:",
"You ate a baked potato!",
"You ate a hot potato! :fire: :potato:",
"You ate a :sparkles: GOLDEN POTATO :sparkles:. Wow you got lucky"]
thing = random.choice(stuff)
if thing == "You ate a baked potato!":
bruh = bot.get_emoji(764554710178201611)
await ctx.channel.send(f"You ate a baked potato! {bruh}")
else:
await ctx.channel.send(random.choice(stuff))
@bot.command(
help="Don't eat it",
brief="Don't eat it",
)
async def banana(ctx):
await ctx.channel.send("You ate a baked banana! :fire: :banana: Ew, that tasted disgusting.")
@bot.command(
help="Eat it",
brief="Eat it"
)
async def hotfood(ctx):
await ctx.channel.send("Hot Food. We sit down to eat, and the potato's a bit hot. So I only put a little bit on my fork and I blow. *puff-puff* 'Til it's cool. Just cool. Then into the mouth. *hawlp* *click* Noice. And there's my brother, he's doing the same. *puff-puff* 'Til it's cool. Just cool. Into the mouth. *hawlp* *click* Noice! There's my mum, she's doing the same. *puff puff* 'Til it's cool. Just cool. Into the mouth. *hawlp* *click* Noice! But my dad. My dad, what does he do? He stuffs a great big chunk of potato into his mouth and then that really does it. His eyes pop out. He flaps his hands. He blows, he puffs, he yells, he bobs his head up and down. He spits bits of potato all over his plate and he turns to us and he goes, \"Watch out, everybody! The potato's really hot!\"")
@bot.command(
help="The worse version of hot food",
brief="The worse version of hot food"
)
async def friedfood(ctx):
await ctx.channel.send("We sit down to YEET :joy::100: and the potato's :potato: a bit HOT :fire::joy::rofl::skull:, so I only put a little bit :pinching_hand: on my fork :fork_and_knife: and I blow :cloud: puff :loud_sound: puff :wind_blowing_face:, 'til it's cool :sunglasses:, just cool :cool:, into the mouth :lips: *hawlp* :astonished: *click* :point_up_2: NOICE :ok_hand::joy::rofl::thinking::grin:. And there's my brother :boy:, he's doing the same :potato: :cloud: puff :loud_sound: puff :wind_blowing_face:, 'til it's cool :snowflake:, just cool :ice_cube:, into the mouth :lips:, *hawlp* :astonished: *click* :point_up_2: NOICE :ok_hand::joy::rofl::thinking::grin:. There's my mum :woman:, she's doing the same :potato:, 'til it's cool :gem:, just cool :v:, into the mouth :lips: *hawlp* :astonished: *click* :point_up_2: NOICE :ok_hand::joy::rofl::thinking::grin:. But my dad :man:, my dad, what does he do? He stuffs :stuffed_flatbread: a great :grin: :b:ig chunk :poop: of potato :sweet_potato::potato: into his mouth :lips: and that really does it :boom:. His eyes :eyes: pop :balloon: out :outbox_tray:. He flaps :door: his hands :raised_hand::raised_back_of_hand:. He blows :wind_blowing_face: he puffs :cloud: he yells :loudspeaker: he bobs his head :skull: up :chart_with_upwards_trend: and down :chart_with_downwards_trend:. He spits :wind_blowing_face: bits :pinching_hand: of potato :potato: all over his plate :fork_knife_plate: and he turns :point_left: to us :flag_us: and he goes :goal:, \"Watch out :outbox_tray: everybody! The potato's :potato: really :boom: HOT! :fire::rocket::sparkles::rofl::joy:\"")
@bot.command(
help="The worse version of hot food",
brief="The worse version of hot food"
)
async def coldfood(ctx):
await ctx.channel.send("Cold Food. We sit down to _BRRRRRRRRRR_ **AHHHH IT'S SO COLD** __HELPP!!!!!!!!!!!__ :cold_face::cold_sweat::ice_cube::snowflake::gem:")
@bot.command(
help="LOL i'm so random!!!1",
brief="Prints a random number",
name="randomnumber"
)
async def lolrandom(ctx, *args):
if len(args) == 0:
await ctx.channel.send(random.randint(0, 10))
elif len(args) == 1:
await ctx.channel.send(random.randint(0, int(args[0])))
else:
await ctx.channel.send(random.randint(int(args[0]), int(args[1])))
@bot.command(
help="Displays approximately how long ago Bongs uploaded his latest video",
brief="Displays approximately how long ago Bongs uploaded his latest video",
name="whenlastvideo",
aliases=["whenlatestvideo", "whenlastvid", "whenlatestvid"]
)
async def asdfjklasdfjkl(ctx):
y = random.randint(100, 10000000)
await ctx.channel.send("Bongs uploaded his latest video **" + str(f'{y:,}') + "** years ago :cry:")
@bot.command(
help="hi",
brief="Displays Minecraft player heads",
name="head"
)
async def playerhead(ctx, *args):
if len(args) == 0:
await ctx.channel.send("Usage: !head <player name>")
elif len(args[0]) > 20:
await ctx.channel.send("**:x: Username is too long!**")
elif len(args[0]) < 3:
await ctx.channel.send("**:x: Username is too short!**")
else:
await ctx.channel.send("https://minotar.net/helm/" + str(args[0]) + "/128")
@bot.command(
help="Get free candy!!!!1",
brief="Get free candy!!!!1",
)
async def freecandy(ctx):
await ctx.channel.send("Nope.")
await ctx.channel.send("https://media1.giphy.com/media/Ju7l5y9osyymQ/200.gif")
@bot.command(
help="Do some quick maffs(TM)",
brief="Do some quick maffs(TM)",
name="1+1"
)
async def quickmath(ctx):
numberthing = random.randint(0, 10)
if numberthing == 2:
if random.randint(0, 1) == 0:
await ctx.channel.send("Uhhhh... it's... sorry, I'm too busy programming the potato and eating the computer.")
else:
await ctx.channel.send("Uhhhh... it's... sorry, I'm too busy cleaning the lawn and mowing my room.")
else:
await ctx.channel.send(str(numberthing))
'''
@bot.command(
help="dont say no no words",
brief="don't say no no words",
name="language",
aliases=['l'],
)
async def lllll(ctx):
asdfjkl = random.randint(0, 2)
if asdfjkl == 0:
await ctx.channel.send("LANGUAGE")
elif asdfjkl == 1:
await ctx.channel.send("**LANGUAGE**")
else:
await ctx.channel.send(
'''
@bot.command(
help="Da ba dee, da ba die!!!",
brief="Generates random misheard lyrics for the song I'm Blue"
)
async def imblue(ctx):
first_words = [
{
"word":"dee",
"p":"n"
},
{
"word":"bleed",
"p":"v"
},
{
"word":"green",
"p":"a"
},
{
"word":"beat",
"p":"v"
},
{
"word":"need",
"p":"v"
},
{
"word":"yeet",
"p":"v"
},
{
"word":"meme",
"p":"n"
},
{
"word":"geek",
"p":"n"
},
{
"word":"dream",
"p":"n"
},
{
"word":"eat",
"p":"v"
},
{
"word":"heat",
"p":"v"
},
{
"word":"pee",
"p":"v"
},
{
"word":"tree",
"p":"n"
},
{
"word":"believe",
"p":"v",
"twoSyllables":True
},
{
"word":"diseased",
"p":"n",
"twoSyllables":True
},
{
"word":"deceased",
"p":"n",
"twoSyllables":True
},
{
"word":"indeed",
"p":"n",
"twoSyllables":True
}
]
second_words = [
{
"word":"dye",
"p":"n"
},
{
"word":"die",
"p":"v"
},
{
"word":"guy",
"p":"n"
},
{
"word":"fly",
"p":"v"
},
{
"word":"pie",
"p":"n"
},
{
"word":"mine",
"p":"n"
},
{
"word":"guy",
"p":"n"
},
{
"word":"diet",
"p":"n"
},
{
"word":"diamond",
"p":"n"
},
{
"word":"lie",
"p":"n"
},
{
"word":"dime",
"p":"n"
},
{
"word":"why",
"p":"all"
},
{
"word":"guide",
"p":"n"
}
]
stuff = {
"n":[
"I'm a",
"up a",
"apple",
"I'm in",
"on a"
],
"v":[
"I will",
"I would",
"I can",
"I could",
"I will",
"imma",
"I must"
],
"a":[
"I am"
],
"all":[
"da ba",
"cobble"
]
}
lyric = ""
first = random.choice(first_words)
first_phrase = ""
second = random.choice(second_words)
second_phrase = ""
if "twoSyllables" in first:
if first["p"] == "n":
first_phrase = "I'm"
else:
first_phrase = "I"
else:
first_phrase = random.choice(stuff[first["p"]])
if random.random() <= 0.1:
first_phrase = random.choice(stuff["all"])
second_phrase = random.choice(stuff[second["p"]])
if random.random() <= 0.1:
second_phrase = random.choice(stuff["all"])
lyric = first_phrase.capitalize() + " " + first["word"] + " " + second_phrase + " " + second["word"]
await ctx.channel.send(lyric)
@bot.event
async def on_member_join(member):
await bot.get_channel(WELCOME_CHANNEL).send(f"**Hey {member.mention}, welcome to Bongs237's server!**\nHere's a free potato: :potato:" + test_msg)
@bot.event
async def on_message(message):
if message.content.lower() == "i like potatoes" or message.content.lower() == "i like potatos" or message.content.lower() == "i love potatoes" or message.content.lower() == "i love potatos":
await message.channel.send("Same!")
# INCLUDES THE COMMANDS FOR THE BOTS. WITHOUT THIS LINE, YOU CANNOT TRIGGER YOUR COMMANDS.
await bot.process_commands(message)
bot.run(TOKEN)