-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGuacBotHQ2.0.py
125 lines (106 loc) · 3.85 KB
/
GuacBotHQ2.0.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
import discord
import asyncio
import time
import os
import subprocess
import random
import re
from discord.ext import commands, tasks
from itertools import cycle
#Version 2.0 experimental
bot = commands.Bot(command_prefix = '#', activity=discord.Game("Only legends see this."))
@bot.event
async def on_ready():
os.system('cls')
print("Main bot processes active.")
change_status.start()
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandNotFound):
await ctx.send("That isn't a command, buddy.")
def is_it_me(ctx):
return ctx.author.id == 409445517509001216
@bot.command()
@commands.check(is_it_me)
async def load(ctx, extension):
bot.load_extension(f'cogs.{extension}')
await ctx.send(f'Extension "{extension}" loaded!')
@load.error
async def load_error(ctx, error):
if isinstance(error, commands.MissingRequiredArgument):
await ctx.send('Please choose what cog to load.')
@bot.command()
@commands.check(is_it_me)
async def unload(ctx, extension):
bot.unload_extension(f'cogs.{extension}')
await ctx.send(f'Extension "{extension}" unloaded!')
@unload.error
async def unload_error(ctx, error):
if isinstance(error, commands.MissingRequiredArgument):
await ctx.send('Please choose what cog to unload.')
@bot.command()
@commands.check(is_it_me)
async def reload(ctx, extension):
bot.unload_extension(f'cogs.{extension}')
bot.load_extension(f'cogs.{extension}')
await ctx.send(f'Extension "{extension}" reloaded!')
@reload.error
async def reload_error(ctx, error):
if isinstance(error, commands.MissingRequiredArgument):
await ctx.send('Please choose what cog to reload.')
@bot.command()
@commands.check(is_it_me)
async def die(ctx):
await ctx.send("Goodbye, father.")
await bot.change_presence(activity=discord.Game("Goodbye."))
ta.kill()
r.kill()
os.system('cls')
quit()
@bot.command()
@commands.check(is_it_me)
async def restart(ctx):
await ctx.send("Restarting!")
ta.kill()
r.kill()
subprocess.Popen(["python", "GuacBotHQ2.0.py"])
quit()
@bot.command()
@commands.check(is_it_me)
async def puppet(ctx):
ta.kill()
os.system('cls')
p = subprocess.Popen(["python", "GuacBotPuppet.py"])
await asyncio.sleep(300)
isDead = p.poll()
if (isDead == None):
p.kill()
os.system('cls')
ta.Popen(["python", "GuacBotTerminalAnimation.py"])
#Load cogs
for filename in os.listdir('./cogs'):
if filename.endswith('.py') and not filename.startswith("_"):
bot.load_extension(f'cogs.{filename[:-3]}')
#Status loop
def NewOrder():
statusorder = []
indices = list(random.sample(range(len(possiblestatuses)), len(possiblestatuses)))
for i in indices:
statusorder.append(possiblestatuses[i])
return statusorder
possiblestatuses = ['you like a damn fiddle', 'with your butt', 'with fire', 'with anime tiddy',
'with knives', 'ROBLOX DEATH RUN', 'Shrek 5 in HD', 'alone :(',
'Fortnite in Area 51', 'with some rope', 'with your heart ;)',
'Minecraft Hunger Games', 'dead', 'with the dark arts', 'with the bois', 'nothing...',
'with myself', "a tune on the world's smallest violin", "RealLife.exe", "a prank on you",
"Discord... what did you expect?", "with needles", "with a hammer", "SONIC.exe"]
status = cycle(NewOrder())
@tasks.loop(seconds=300)
async def change_status():
await bot.change_presence(activity=discord.Game(next(status)))
#Open other GuacBot pieces
r = subprocess.Popen(["python", "GuacBotReaction2.5.py"])
ta = subprocess.Popen(["python", "GuacBotTerminalAnimation.py"])
#Start bot with token in text file
TOKEN = open("TOKEN.txt", "r").read()
bot.run(TOKEN)