diff options
Diffstat (limited to '')
| -rw-r--r-- | main.py | 16 |
1 files changed, 14 insertions, 2 deletions
| @@ -1,17 +1,29 @@ | |||
| 1 | import datetime | 1 | import datetime |
| 2 | import logging | ||
| 2 | import os | 3 | import os |
| 4 | import sys | ||
| 3 | 5 | ||
| 4 | # create a pycord bot template | 6 | # create a pycord bot template |
| 5 | import discord | 7 | import discord |
| 6 | from discord.ext import commands | 8 | from discord.ext import commands |
| 7 | from dotenv import load_dotenv | 9 | from dotenv import load_dotenv |
| 8 | 10 | ||
| 11 | # Configure logging | ||
| 12 | logging.basicConfig( | ||
| 13 | level=logging.INFO, | ||
| 14 | format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', | ||
| 15 | handlers=[ | ||
| 16 | logging.StreamHandler(sys.stdout) | ||
| 17 | ] | ||
| 18 | ) | ||
| 19 | logger = logging.getLogger(__name__) | ||
| 20 | |||
| 9 | bot = commands.Bot(intents=discord.Intents.all()) | 21 | bot = commands.Bot(intents=discord.Intents.all()) |
| 10 | 22 | ||
| 11 | 23 | ||
| 12 | @bot.event | 24 | @bot.event |
| 13 | async def on_ready(): | 25 | async def on_ready(): |
| 14 | print(f"ŁUKASZ SPERMA AKTYWACJA" + datetime.datetime.now().strftime("(%Y-%m-%d %H:%M:%S)")) | 26 | logger.info("ŁUKASZ SPERMA AKTYWACJA" + datetime.datetime.now().strftime("(%Y-%m-%d %H:%M:%S)")) |
| 15 | # send the message to channel ID | 27 | # send the message to channel ID |
| 16 | channel = bot.get_channel(1081667823799111804) | 28 | channel = bot.get_channel(1081667823799111804) |
| 17 | await channel.send("ŁUKASZ SPERMA AKTYWACJA") | 29 | await channel.send("ŁUKASZ SPERMA AKTYWACJA") |
| @@ -35,6 +47,6 @@ if __name__ == "__main__": | |||
| 35 | ] | 47 | ] |
| 36 | for i, extension in enumerate(extensions, 1): | 48 | for i, extension in enumerate(extensions, 1): |
| 37 | bot.load_extension(extension) | 49 | bot.load_extension(extension) |
| 38 | print(f"Loaded {i}/{len(extensions)} extensions") | 50 | logger.info(f"Loaded {i}/{len(extensions)} extensions") |
| 39 | 51 | ||
| 40 | bot.run(str(os.getenv("TOKEN"))) | 52 | bot.run(str(os.getenv("TOKEN"))) |
