mirror of
https://github.com/alterware/aw-bot.git
synced 2025-10-26 22:16:58 +00:00
feat: store punished users
This commit is contained in:
16
bot/tasks.py
16
bot/tasks.py
@@ -6,9 +6,13 @@ from discord.ext import tasks, commands
|
||||
|
||||
from bot.utils import aware_utcnow, fetch_api_data
|
||||
|
||||
from database import migrate_users_with_role
|
||||
|
||||
TARGET_DATE = datetime(2036, 8, 12, tzinfo=timezone.utc)
|
||||
OFFTOPIC_CHANNEL = 1112048063448617142
|
||||
|
||||
SPAM_ROLE_ID = 1350511935677927514
|
||||
|
||||
COD_GAMES = {
|
||||
10180: {"name": "Modern Warfare 2 (2009)", "channel": 1145458108190163014},
|
||||
42680: {"name": "Modern Warfare 3 (2011)", "channel": 1145459504436220014},
|
||||
@@ -18,6 +22,16 @@ COD_GAMES = {
|
||||
}
|
||||
|
||||
|
||||
async def migrate_all_users(bot):
|
||||
# Fetch users with the SPAM_ROLE_ID and migrate them to the database
|
||||
guild = discord.utils.get(bot.guilds)
|
||||
if guild:
|
||||
spam_role = discord.utils.get(guild.roles, id=SPAM_ROLE_ID)
|
||||
if spam_role:
|
||||
for member in spam_role.members:
|
||||
migrate_users_with_role(member.id, SPAM_ROLE_ID)
|
||||
|
||||
|
||||
class SteamSaleChecker(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
@@ -132,6 +146,8 @@ async def setup(bot):
|
||||
except Exception as e:
|
||||
print(f"An error occurred in heat_death task: {e}")
|
||||
|
||||
await migrate_all_users(bot)
|
||||
|
||||
update_status.start()
|
||||
heat_death.start()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user