-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
94 lines (79 loc) · 2.32 KB
/
bot.py
File metadata and controls
94 lines (79 loc) · 2.32 KB
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
"""
Root bot file.
(C) 2022 - Jimmy-Blue
"""
import os
from interactions import (
Client,
ClientPresence,
Intents,
PresenceActivity,
CommandContext,
PresenceActivityType,
StatusType,
Embed,
EmbedFooter,
Button,
ButtonStyle,
)
from const import TOKEN, EXTENSION
from interactions.ext.wait_for import setup
class Bot(Client):
"""Class represents the bot client."""
def __init__(self, *args, **kwargs) -> None:
super().__init__(
token=TOKEN,
intents=Intents.DEFAULT
| Intents.GUILD_MESSAGE_CONTENT,
presence=ClientPresence(
activities=[
PresenceActivity(
type=PresenceActivityType.WATCHING,
name="for incoming mail."
),
],
status=StatusType.ONLINE,
),
)
self.event()(self.on_ready)
async def on_ready(self):
websocket = f"{self.latency * 1:.0f}"
print("Bot is ready.")
print(f"Latency: {websocket}ms")
client = Bot()
setup(client)
[client.load(f"exts.{ext}") for ext in EXTENSION]
@client.command(
name="about",
description="About Mercury.",
)
async def _about(ctx: CommandContext):
buttons = [
Button(
style=ButtonStyle.LINK,
label="Repository",
url="https://github.com/Jimmy-Blue/Mercury",
),
Button(
style=ButtonStyle.LINK,
label="Profile",
url="https://blue.is-a.dev",
),
]
embed = Embed(
title="Mercury",
description="".join(
[
"Mercury is a modmail Discord bot that members can use to get in touch with the moderation team.\n\n",
"This project is created and maintained by Blue#2095. You can have a look at the repository",
" and his profile by clicking on the buttons below.",
]
),
color=0x08A46C,
footer=EmbedFooter(
text=f"Requested by {ctx.user.username}#{ctx.user.discriminator}",
icon_url=ctx.user.avatar_url,
),
)
await ctx.send(embeds=embed, components=buttons)
client.start()