-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdesign.txt
79 lines (57 loc) · 1.54 KB
/
design.txt
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
needs
- base class
- add commands
- handle discord connections
- map commands to functions
- entity structures for users, perms, etc
- T E S T
- handle heartbeats
- steps
- define commands
- tell discord in batch request
- after confirm, initiate connection request (socket) from bot
users concerns
- create commands
- push commands
- initiate connection
- easily repeatable
# example
from ourLib.client import Client, Command, Options, Interaction
from ourLib.command import SlashCommand, Option
try:
client = Client('token', intents=[])
catch Exception e:
print(e)
break
async def hello_handler(interaction: Interaction):
interaction.reply('hello')
# 3 ways?
Command(name='Hello', ...)
client.push(commands)
or Client(token='token', intents=[], commands=[Command])
# discord slash commands
client.push(new Command(name='Hello', desc='I am a command', options=[stuff: Option], guild_id=123456, guild_ids, handler=hello_handler))
if !client.register():
throw 'failed to register commands'
# event handling for discord
client.on('death', function)
if !client.connect():
throw 'Failed to Connect'
client() # used to run the bot
class Client(Stack):
# init
command_dict
event_dict
runner()
__call__():
start connection
initiate heartbeat with intents
1. heartbeat
2. check for events
3. check for commands
on error do webhook for death
class User
class Interaction
class Guild
static enum of intents
socket for connection