-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_custom_bot.py
48 lines (43 loc) · 1.25 KB
/
run_custom_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
import asyncio
from main import *
from bots.channels import *
# define the bot
my_custom_bot = {
'token_env': 'DISCORD_TOKEN_CHIBA',
'debug': False,
'programs': {
'my_custom': {
'name': 'Chiba',
'data': 'hello world'
}
},
'behaviors': {
'on_mention': {
'response_probability': 1.0,
'channels': all_channels_testnet,
'delay': [0, 1],
'program': 'my_custom',
'reaction_probability': 0.25,
'reply_probability': 1.0
}
}
}
# define custom program here
class DiscordBotCustom(DiscordBot):
async def run_program_custom(self, program, settings):
await asyncio.sleep(0)
print('Running custom program: {}'.format(program))
name, data = settings.name, settings.data
response = 'My name is {}: "{}"'.format(name, data)
embed, file = None, None
return response, embed, file
# overwrite global variables if you want
reactions_enabled = False
# run
load_dotenv()
intents = discord.Intents.default()
intents.members = True
loop = asyncio.get_event_loop()
client = DiscordBotCustom(intents=intents)
loop.create_task(client.setup(my_custom_bot))
loop.run_forever()