diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d590e9a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM python:3.8.10-slim + +# install dependencies for mysqlclient +# RUN apt-get update && apt-get -y upgrade && apt-get -y install python3-dev default-libmysqlclient-dev build-essential + +RUN pip install --upgrade pip + +WORKDIR /home + +COPY cogs cogs/ +COPY dakiny_bot.py dakiny_bot.py +COPY requirements.txt requirements.txt + +RUN pip install -r requirements.txt + +# remove build deps that aren't needed to run +# RUN apt-get -y remove python3-dev build-essential && apt-get -y autoremove + +CMD ["python3", "./dakiny_bot.py"] \ No newline at end of file diff --git a/cogs/loops/__init__.py b/cogs/loops/__init__.py new file mode 100644 index 0000000..20564de --- /dev/null +++ b/cogs/loops/__init__.py @@ -0,0 +1,15 @@ +""" +Initializing code for all loops. +""" + +from nextcord.ext import commands + +from .daily_loop import DailyLoop + + +def setup(bot: commands.Bot): + """ + Adds functions to bot. + """ + + bot.add_cog(DailyLoop(bot)) diff --git a/cogs/loops/daily_loop.py b/cogs/loops/daily_loop.py new file mode 100644 index 0000000..f12b5f9 --- /dev/null +++ b/cogs/loops/daily_loop.py @@ -0,0 +1,23 @@ +""" +_summary_ +""" + +import nextcord +from nextcord.ext import commands, tasks +from datetime import time +from pytz import timezone + + +class DailyLoop(commands.Cog, name="Daily Loop"): + """ + Class for performing daily functions. + """ + + def __init__(self, bot: commands.Bot) -> None: + self.bot = bot + + @tasks.loop(time=time(hour=0, tzinfo=timezone("GMT"))) + async def do_thing(self): + """ """ + imcompiling: nextcord.User = await self.bot.fetch_user(206602713511886849) + await imcompiling.send("its reset in runescape") diff --git a/config.py b/config.py index 21eb1e4..2383790 100644 --- a/config.py +++ b/config.py @@ -6,4 +6,3 @@ load_dotenv() # Discord config DISCORD_TOKEN = os.getenv("DISCORD_TOKEN", "") -BOT_PREFIX = "?" diff --git a/bot.py b/dakiny_bot.py similarity index 76% rename from bot.py rename to dakiny_bot.py index 9f5d293..91d5ec3 100644 --- a/bot.py +++ b/dakiny_bot.py @@ -20,16 +20,7 @@ def main(): # To enable the members priveleged intent: # intents.members = True - # Set custom status to "Listening to ?help" - activity = nextcord.Activity( - type=nextcord.ActivityType.listening, name=f"{config.BOT_PREFIX}help" - ) - - bot = commands.Bot( - commands.when_mentioned_or(config.BOT_PREFIX), - intents=intents, - activity=activity, - ) + bot = commands.Bot(intents=intents) # Get the modules of all cogs whose directory structure is ./cogs/ for folder in os.listdir("cogs"): diff --git a/requirements.txt b/requirements.txt index 2212c02..97a0b72 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ nextcord==2.4.2 python-dotenv==1.0.0 +pytz==2022.7.1 \ No newline at end of file