-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
65 lines (52 loc) · 2.38 KB
/
main.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
from os import listdir
from discord.ext import commands
from discord import Intents
from helpers.utils import sendFalloutMessage, log_file
import asyncio
import helpers.env as env
intents = Intents.default()
intents.voice_states = True
intents.message_content = True
bot = commands.Bot(command_prefix=">", help_command=None, intents=intents)
def printVoiceChannels(channel_ids_list: list[int]):
message = ""
for i, channel_id in enumerate(channel_ids_list):
channel = bot.get_channel(channel_id)
message += f"`{i+1}. {channel.name}`\n"
return message
@bot.event
async def on_ready():
print("activity_channel_id=", env.activity_channel_id)
print("cam_only_channel_ids=", env.cam_only_channel_ids)
print("cams_only_kick_period=", env.cams_only_kick_period)
print("cams_only_move_vc_id=", env.cams_only_move_vc_id)
print("cams_only_warn_period=", env.cams_only_warn_period)
print("coworking_channel_ids=", env.coworking_channel_ids)
print("coworking_role_id=", env.coworking_role_id)
print("discord_token=", env.discord_token)
print("fallout_channel_id=", env.fallout_channel_id)
print("====================")
print("self.dev Watcher is ready")
print("====================")
await sendFalloutMessage(
bot,
f"```Initializing watcher, make sure that the bot is put above the coworking role to avoid any issues ```"
+ "\n**Current watcher configuration**\n"
+ f"\n**Co-working VCs**\n{printVoiceChannels(env.coworking_channel_ids)}\n*Co-working role ID*\n{env.coworking_role_id}\n"
+ f"\n**Cam-only VCs**\n{printVoiceChannels(env.cam_only_channel_ids)}\n- Warn period: {env.cams_only_warn_period} seconds\n- Kick period: {env.cams_only_kick_period} seconds\n"
+ "\n- Move VC: "
+ (
bot.get_channel(env.cams_only_move_vc_id)
and bot.get_channel(env.cams_only_move_vc_id).name
or 'They gon" get kicked.'
)
+ f"\n\n**Activity**\n\n{bot.get_channel(env.activity_channel_id).mention}"
+ "\nAll the issues will be reported in this channel.\n\nAlright bye now, time to watch :nazar_amulet:",
"Initialized",
)
async def loadCogs():
for filename in listdir("./events"):
if filename.endswith(".py"):
await bot.load_extension(f"events.{filename[:-3]}")
asyncio.run(loadCogs())
bot.run(env.discord_token)