dev #4
11
main.py
11
main.py
|
@ -1,13 +1,13 @@
|
|||
from typing import Optional, List
|
||||
from os import getenv, listdir
|
||||
import discord
|
||||
import re
|
||||
|
||||
import discord
|
||||
from discord import app_commands
|
||||
from discord.app_commands import Choice
|
||||
from discord.ext import commands
|
||||
from dotenv import load_dotenv
|
||||
|
||||
|
||||
load_dotenv()
|
||||
|
||||
|
||||
|
@ -16,12 +16,14 @@ class MyClient(commands.Bot):
|
|||
intents = discord.Intents.none()
|
||||
intents.guilds = True
|
||||
intents.messages = True
|
||||
intents.message_content = True
|
||||
super().__init__(intents=intents, command_prefix=".")
|
||||
|
||||
self.MY_GUILD = discord.Object(id=getenv("GUILD_ID"))
|
||||
|
||||
self.initial_extensions = ["cogs." + f[:-3] for f in listdir("./cogs") if
|
||||
f.endswith(".py") and f.__str__() != "__init__.py"]
|
||||
#self.add_listener(self.on_message)
|
||||
|
||||
async def setup_hook(self):
|
||||
# cogs
|
||||
|
@ -36,6 +38,11 @@ class MyClient(commands.Bot):
|
|||
print(f"Discord version : {discord.__version__}")
|
||||
print('------')
|
||||
|
||||
async def on_message(self, msg):
|
||||
p = re.compile("[qQ]uoi[ \\.!?;]*$")
|
||||
print(f"{msg!r}")
|
||||
if p.search(msg.content) is not None:
|
||||
await msg.reply("Quoicoubeh !")
|
||||
|
||||
if __name__ == "__main__":
|
||||
client = MyClient()
|
||||
|
|
Loading…
Reference in New Issue