-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
183 lines (158 loc) Β· 13.1 KB
/
Copy pathbot.py
File metadata and controls
183 lines (158 loc) Β· 13.1 KB
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
import HypixelApi
import discord
from discord.ext import commands, tasks
import time
import os
import requests
import random
import ElonMuskJet
from dotenv import load_dotenv
# importing environmental vars
load_dotenv()
TOKEN = os.getenv("DISCORD_TOKEN")
GUILD = os.getenv("DISCORD_GUILD")
APP_ID = os.getenv("APP_ID")
PUB_KEY = os.getenv("PUBLIC_KEY")
GUILD_ID = os.getenv("GUILD_ID")
GENERAL_CHAN_ID = os.getenv("CHANNEL_GENERAL_ID")
#finished importing .env vars
intents = discord.Intents.all()
activity = discord.Activity(name="being awesome losers", type = discord.ActivityType.streaming)
bot = discord.Bot(intents=intents, activity=activity)
@bot.event
async def on_ready():
print(f"We have logged in as {bot.user}")
channel = bot.get_channel(956302622170701946)
HypixelApi.apiRequestGeneral()
await channel.send(HypixelApi.apiRequestSpecific('date'))
checkSkyblockDay.start()
@bot.slash_command(description="says \"Hello!\"")
async def hello(ctx):
await ctx.respond("Hello!")
async def printMessages():
channel = bot.get_channel(956302622170701946)
await channel.send("<@520374895394291714> Time for Fallen Star Cult, " + HypixelApi.apiRequestSpecific('date'))
@tasks.loop(seconds=10)
async def checkSkyblockDay():
data = HypixelApi.apiRequestGeneral()
sbDay = data['day']
happened = False
if sbDay == 7:
await printMessages()
happened = True
while happened == True:
time.sleep(1200)
happened = False
elif sbDay == 14:
await printMessages()
happened = True
while happened == True:
time.sleep(1200)
happened = False
elif sbDay == 21:
await printMessages()
happened = True
while happened == True:
time.sleep(1200)
happened = False
elif sbDay == 28:
await printMessages()
happened = True
while happened == True:
time.sleep(1200)
happened = False
else:
print('it is not time π ' + HypixelApi.apiRequestSpecific('date') + " " + HypixelApi.apiRequestSpecific('time'))
@bot.slash_command(description="gives you the weather no shit sherlock")
async def weather(ctx, place: str):
repsonse = requests.get('http://api.weatherstack.com/current?access_key=1261911b962a009e45e7d4e65d687c92&query=' + place + "&units=m")
datajson = repsonse.json()
await ctx.respond("weather for " + place)
percentSign = "%"
txt = u'In %s,%s it is the %s. It is %sβ and %s. It feels like %sβ, the humidity levels are %s%%, there is a %s%% chance of precipitation, the clouds cover %s%% of the sky, you can see for %skm with a wind speed of %skm/m' % (datajson['location']['name'],datajson['location']['country'],datajson['location']['localtime'],datajson['current']['temperature'],datajson['current']['weather_descriptions'],datajson['current']['feelslike'],datajson['current']['humidity'],datajson['current']['precip'],datajson['current']['cloudcover'],datajson['current']['visibility'],datajson['current']['wind_speed'])
fullTxt = txt.format(percentSign, percentSign)
await ctx.respond(fullTxt)
weatherIconStr = u'%s' % (datajson['current']['weather_icons'])
await ctx.respond(weatherIconStr)
@bot.slash_command(description="tracks elon musk's cool private jet")
async def trackelonmusk(ctx):
await ctx.respond(ElonMuskJet.flight_data)
@bot.slash_command(guild_ids=[GUILD_ID], description="Kills bot and makes it unusable")
async def close(ctx):
await ctx.respond("i fricking died bro :sob:")
await bot.close()
@bot.slash_command(description="addition cmon you know math")
async def add(ctx, num1: int, num2: int):
sum = num1 + num2
await ctx.respond(f"{num1} plus {num2} is {sum}.", ephemeral = True)
@bot.command(description="Sends the bot's latency.") # this decorator makes a slash command
async def ping(ctx): # a slash command will be created with the name "ping"
await ctx.respond(f"Pong! Latency is {bot.latency}")
@bot.slash_command(description="Sends the best team in this year's world cup")
async def betterteam(ctx):
await ctx.respond("The best team is obviously Morocco!")
await ctx.respond("What did you think, that I wasn't biased?", ephemeral = True)
@bot.slash_command(description="Copies you")
async def copyme(ctx, txt: str):
await ctx.respond(txt)
@bot.slash_command(description="Annoy someone",guild_ids=[GUILD_ID])
async def send_message(ctx, user_id: str, message: str):
user = bot.get_user(int(user_id))
try:
await user.send(message)
await ctx.respond("Message sent successfully!", ephemeral = True)
except:
await ctx.respond("Failed to send message. User probably has closed DMs", ephemeral = True)
@bot.slash_command(name="katana", description="sends you a katana you can copy and paste to stab your friends!")
async def katana(ctx):
await ctx.respond("β¬β¬ΞΉβββββββοΊ€ Now go, dear adventurer, and vanquish your foes!")
@bot.slash_command(description="long katana")
async def long_katana(ctx):
await ctx.respond("β¬β¬ΞΉββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββοΊ€ Here is your **extra** long katana. Why do you need this exactly?")
@bot.slash_command(name="whoami",description="testing")
async def whoishe (ctx,user:discord.Member):
role = discord.utils.get(ctx.guild.roles, name="CoolPeople")
user_id = ctx.author.id
if role in user.roles:
await ctx.respond(f"<@{user_id}> is one of the cool kids :sunglasses:")
else:
await ctx.respond("Somone who is **not** one of the cool kids")
@bot.slash_command(name="betteroption", description="Chooses the better option between two options given by the user")
async def betterOption(ctx, option1: str, option2: str):
randomizer = random.randint(1,2)
if option1 == "Technoblade":
await ctx.respond(f"Legends never die, Technoblade is the best, May he defeat God in his final battle :pig: :dove:")
elif option2 == "Technoblade":
await ctx.respond(f"Legends never die, Technoblade is the best, May he defeat God in his final battle :pig: :dove:")
elif option1 == "technoblade":
await ctx.respond(f"Legends never die, Technoblade is the best, May he defeat God in his final battle :pig: :dove:")
elif option2 == "technoblade":
await ctx.respond(f"Legends never die, Technoblade is the best, May he defeat God in his final battle :pig: :dove:")
elif option1 == "Morocco":
await ctx.respond(f"MOROCCO FOREVER :flag_ma::flag_ma::flag_ma:")
elif option2 == "Morocco":
await ctx.respond(f"MOROCCO FOREVER :flag_ma::flag_ma::flag_ma:")
elif option1 == "morocco":
await ctx.respond(f"MOROCCO FOREVER :flag_ma::flag_ma::flag_ma:")
elif option2 == "morocco":
await ctx.respond(f"MOROCCO FOREVER :flag_ma::flag_ma::flag_ma:")
elif randomizer == 1:
await ctx.respond(f"Obviously {option1} is the better option from both of them")
elif randomizer == 2:
await ctx.respond(f"Obviously {option2} is the better option from both of them")
else:
await ctx.respond("Try something else maybe?", ephemeral = True)
@bot.event
async def on_message(message):
channel = bot.get_channel(956302622170701946)
if message.content.startswith("help"):
i = 1
while i < 1000:
await message.author.send("lmao")
i += 1
await message.author.send('no')
if message.content.startswith("die"):
await channel.send("*dies*")
await bot.close()
if __name__ == '__main__':
bot.run(TOKEN)