-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.py
44 lines (32 loc) · 1.19 KB
/
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
from games import RockPaperScissorsHandler, TicTacToeHandler
from conversation import conversation
from senders import help_msg_sender, metrics_report_sender
import metrics_utils
from dbl_class import TopGG
from discord import AutoShardedClient
from dotenv import load_dotenv
import os
SHARD_COUNT=2
load_dotenv()
DISCORD_TOKEN = os.getenv("DISCORD_TOKEN")
class ZeroTwoBot(AutoShardedClient):
async def on_ready(self) -> None:
self.dbl = TopGG(client)
print("Connected")
print(f"num shards: {len(self.latencies)}")
async def on_message(self, msg) -> None:
# ignore self
if msg.author == self.user:
return
# conversation
await help_msg_sender.respond_to_help(msg)
await conversation.respond_to_name(msg)
await conversation.respond_to_trigger_word(msg)
await conversation.respond_to_certain_things(msg)
# games
await RockPaperScissorsHandler.create_rps_game(client, msg)
await TicTacToeHandler.create_ttt_game(client, msg)
# metrics report
await metrics_report_sender.respond_to_report_request(msg)
client = ZeroTwoBot(shard_count=SHARD_COUNT)
client.run(DISCORD_TOKEN)