Create loop, setup docker file for testing.
This commit is contained in:
+19
@@ -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"]
|
||||||
@@ -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))
|
||||||
@@ -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")
|
||||||
@@ -6,4 +6,3 @@ load_dotenv()
|
|||||||
|
|
||||||
# Discord config
|
# Discord config
|
||||||
DISCORD_TOKEN = os.getenv("DISCORD_TOKEN", "")
|
DISCORD_TOKEN = os.getenv("DISCORD_TOKEN", "")
|
||||||
BOT_PREFIX = "?"
|
|
||||||
|
|||||||
+1
-10
@@ -20,16 +20,7 @@ def main():
|
|||||||
# To enable the members priveleged intent:
|
# To enable the members priveleged intent:
|
||||||
# intents.members = True
|
# intents.members = True
|
||||||
|
|
||||||
# Set custom status to "Listening to ?help"
|
bot = commands.Bot(intents=intents)
|
||||||
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,
|
|
||||||
)
|
|
||||||
|
|
||||||
# Get the modules of all cogs whose directory structure is ./cogs/<module_name>
|
# Get the modules of all cogs whose directory structure is ./cogs/<module_name>
|
||||||
for folder in os.listdir("cogs"):
|
for folder in os.listdir("cogs"):
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
nextcord==2.4.2
|
nextcord==2.4.2
|
||||||
python-dotenv==1.0.0
|
python-dotenv==1.0.0
|
||||||
|
pytz==2022.7.1
|
||||||
Reference in New Issue
Block a user