Created birthday-feature branch and added tests for the feature
This commit is contained in:
22
main.py
22
main.py
@@ -1,7 +1,9 @@
|
|||||||
import os, discord, logging
|
import os, discord, logging
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
from discord.ext import tasks
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO, format='[%(levelname)s] %(asctime)s: %(name)s: %(message)s')
|
||||||
LOGGER = logging.getLogger('botmafieux')
|
LOGGER = logging.getLogger('botmafieux')
|
||||||
LOGGER.setLevel(logging.DEBUG)
|
LOGGER.setLevel(logging.DEBUG)
|
||||||
handler = logging.FileHandler(filename='botmafieux.log', encoding='utf-8', mode='w')
|
handler = logging.FileHandler(filename='botmafieux.log', encoding='utf-8', mode='w')
|
||||||
@@ -15,7 +17,23 @@ bot_intents.presences = True
|
|||||||
bot_intents.guilds = True
|
bot_intents.guilds = True
|
||||||
bot_intents.reactions = True
|
bot_intents.reactions = True
|
||||||
|
|
||||||
bot = discord.Client(command_prefix='$',intents=bot_intents)
|
bot = discord.Bot(command_prefix='$', intents=bot_intents)
|
||||||
|
|
||||||
|
@bot.slash_command(description="Test")
|
||||||
|
async def test(ctx:discord.ApplicationContext):
|
||||||
|
user = ctx.author
|
||||||
|
LOGGER.debug(f'{user.name} used /test.')
|
||||||
|
await ctx.send_response('test',ephemeral=True)
|
||||||
|
|
||||||
|
@tasks.loop(time=datetime.time(datetime.strptime('00:00','%H:%M')))
|
||||||
|
async def test_loop():
|
||||||
|
LOGGER.debug('test_loop')
|
||||||
|
|
||||||
|
@bot.event
|
||||||
|
async def on_ready():
|
||||||
|
LOGGER.info(f'{bot.user.name} has connected to Discord!')
|
||||||
|
LOGGER.debug(f'Guilds: {bot.guilds}')
|
||||||
|
test_loop.start()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|||||||
Reference in New Issue
Block a user