-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcore.py
248 lines (216 loc) · 7.15 KB
/
core.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
from interactions import Client, Intents, listen
from interactions import slash_command, SlashContext
from interactions import OptionType, slash_option
from interactions import Button, ButtonStyle, ComponentContext, component_callback
from interactions import Embed
import interactions
with open('discToken.txt', 'r') as file:
token = file.read() # token hidden using .gitignore file
with open('guildToken.txt', 'r') as file:
guild = file.read()
with open('aiToken.txt', 'r') as file:
ai = file.read()
bot = Client(intents=Intents.DEFAULT, token=token) # defines the bot using the token
# intents are events the bot is receiving from discord
@listen() # waits for this event to be excuted
async def on_ready(): # when the bot is ready
print("Bot is ready!")
@bot.event
async def on_start():
await bot.change_presence(interactions.ClientPresence(activities=[interactions.PresenceActivity(name='/help', type=interactions.PresenceActivityType.WATCHING)]))
@slash_command(
name="meow",
description="first command woo",
) # normal command
async def meow(ctx: SlashContext):
await ctx.send("meow") # sends 'meow' in the channel the user aks the command in
@slash_command(
name="num",
description="i like this number",
scopes=[guild]
)
@slash_option(
name="integer_option",
description="Integer Option",
required=True,
opt_type=OptionType.INTEGER
)
async def num(ctx: SlashContext, integer_option: int):
await ctx.send(f"wow i like the number: {integer_option}") # command testing out command options
# @slash_command(
# name="base",
# description="My command base",
# group_name="group",
# group_description="My command group",
# sub_cmd_name="command",
# sub_cmd_description="My command",
# scopes=[guild]
# )
# async def my_command_function(ctx: SlashContext):
# await ctx.send("Hello World") # sub function
@slash_command(
name="ping",
description="returns the bots ping",
scopes=[guild]
)
async def ping(ctx: SlashContext):
await ctx.send(f"ping: {bot.latency * 1000}") # random command
@slash_command(
name="help",
description="help command for the bot",
scopes=[guild]
)
async def help(ctx: SlashContext):
components = [
Button(
style=ButtonStyle.GREEN,
label="Stocks",
custom_id="stocksHelpButton",
disabled=False
),
Button(
style=ButtonStyle.BLUE,
label="AI",
custom_id="AIHelpButton",
disabled=False
),
Button(
style=ButtonStyle.BLURPLE,
label="VC",
custom_id="vcHelpButton",
disabled=False
),
Button(
style=ButtonStyle.BLURPLE,
label="Ethical Hacking",
custom_id="ehHelpButton",
disabled=False
),
Button(
style=ButtonStyle.GRAY,
label="Misc",
custom_id="miscHelpButton",
disabled=False
)
]
await ctx.send("what do you need help with homie", components=components)
# help buttons
@component_callback("miscHelpButton")
async def misc_help_button(ctx: ComponentContext):
components= [Button(
style=ButtonStyle.GREEN,
label="Stocks",
custom_id="stocksHelpButton",
disabled=False
),
Button(
style=ButtonStyle.BLUE,
label="AI",
custom_id="AIHelpButton",
disabled=False
),
Button(
style=ButtonStyle.BLURPLE,
label="VC",
custom_id="vcHelpButton",
disabled=False
),
Button(
style=ButtonStyle.BLURPLE,
label="Ethical Hacking",
custom_id="ehHelpButton",
disabled=False
)
]
embed = Embed()
embed.set_author(name='Miscellaneous Commands')
embed.add_field(name='/ping', value='returns the ping of the bot', inline=False)
embed.add_field(name='/meow',value='meow',inline=False)
embed.add_field(name='/num (number)', value='returns a number that the bot loves', inline=False)
embed.set_footer(text='you are hot for using this bot <3')
await ctx.send(embeds=embed, components=components)
@component_callback("stocksHelpButton")
async def stocks_help_button(ctx: ComponentContext):
components= [
Button(
style=ButtonStyle.BLUE,
label="AI",
custom_id="AIHelpButton",
disabled=False
),
Button(
style=ButtonStyle.BLURPLE,
label="VC",
custom_id="vcHelpButton",
disabled=False
),
Button(
style=ButtonStyle.BLURPLE,
label="Ethical Hacking",
custom_id="ehHelpButton",
disabled=False
),
Button(
style=ButtonStyle.GRAY,
label="Misc",
custom_id="miscHelpButton",
disabled=False
),
]
embed = Embed()
embed.set_author(name="Stock Commands")
embed.add_field(name="/stock_definitions", value='provides general definitions on stock data', inline=False)
embed.add_field(name="/stocks", value='provides data on stocks', inline=False)
embed.set_footer(text='get your money up 🤑')
await ctx.send(embeds=embed, components=components)
@component_callback("vcHelpButton")
async def vc_help_button(ctx: ComponentContext):
await ctx.send("working in progress :warning:")
@component_callback("AIHelpButton")
async def AI_help_button(ctx: ComponentContext):
await ctx.send("working in progress :warning:")
@component_callback("ehHelpButton")
async def eh_help_button(ctx: ComponentContext):
components= [
Button(
style=ButtonStyle.BLUE,
label="AI",
custom_id="AIHelpButton",
disabled=False
),
Button(
style=ButtonStyle.BLURPLE,
label="VC",
custom_id="vcHelpButton",
disabled=False
),
Button(
style=ButtonStyle.GREEN,
label="Stocks",
custom_id="stocksHelpButton",
disabled=False
),
Button(
style=ButtonStyle.GRAY,
label="Misc",
custom_id="miscHelpButton",
disabled=False
),
]
embed = Embed()
embed.set_author(name="Ethical Hacking Commands")
embed.add_field(name="/sherlock", value='searches the internet for all accounts linked to the username you provide', inline=False)
embed.set_footer(text='hey Joe Goldberg')
await ctx.send(embeds=embed, components=components)
# embed = Embed()
# embed.set_author(name='Stock Definitions')
# embed.add_field(name='Open', value='the price the stock opened at', inline=False)
# embed.add_field(name='High',value='the highest price during the day',inline=False)
# embed.add_field(name='Low', value='the lowest price during the day', inline=False)
# embed.add_field(name='Close', value='the closing price on the trading day', inline=False)
# embed.add_field(name='Volume', value='how many shares were traded')
# embed.set_footer(text='you are hot for using this bot <3')
# await ctx.send(embeds=embed)
bot.load_extension("cogs.stock") # loading stock cog
bot.load_extension("cogs.ethicalHacking") # loading stock cog
bot.start() # starts bot