mirror of
https://github.com/Matthww/TuneBot.git
synced 2026-09-21 22:07:48 +00:00
Moved rpc loop to bot.py
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import discord
|
||||
from discord.colour import Color
|
||||
from discord.ext import commands
|
||||
from discord.ext import commands, tasks
|
||||
import sys
|
||||
import json
|
||||
from typing import Any, Dict, List, Sequence
|
||||
@@ -19,6 +19,9 @@ class ChristmasBot(commands.Bot):
|
||||
voice_states=True, guild_messages=True, guilds=True, messages=True
|
||||
)
|
||||
|
||||
self.rpc_is_help_message = True
|
||||
self.update_status.start()
|
||||
|
||||
self.config = config
|
||||
self.initial_cog_names: List[str] = self.config.get("cogs", [])
|
||||
self.colors: Dict[str, Color] = self.process_colours(config.get("colors", []))
|
||||
@@ -69,6 +72,16 @@ class ChristmasBot(commands.Bot):
|
||||
colour_dict[name] = Color(int(color, 16))
|
||||
return colour_dict
|
||||
|
||||
@tasks.loop(seconds=20)
|
||||
async def update_status(self):
|
||||
await self.wait_until_ready()
|
||||
title = "ck!connect | ck!help"
|
||||
if self.rpc_is_help_message:
|
||||
title = "Tfoe broer"
|
||||
self.rpc_is_help_message = not self.rpc_is_help_message
|
||||
|
||||
await self.change_presence(activity=discord.Game(title))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
|
||||
@@ -13,17 +13,6 @@ from utils.paginator import HelpPaginator
|
||||
class InformationCog(commands.Cog, name="Information"):
|
||||
def __init__(self, bot: commands.Bot):
|
||||
self.bot = bot
|
||||
self.is_help_msg = True
|
||||
self.update_status.start()
|
||||
|
||||
@tasks.loop(seconds=30.0)
|
||||
async def update_status(self):
|
||||
await self.bot.wait_until_ready()
|
||||
title = "ck!connect | ck!help"
|
||||
if self.is_help_msg:
|
||||
title = "Tfoe broer"
|
||||
self.is_help_msg = not self.is_help_msg
|
||||
await self.bot.change_presence(activity=discord.Game(title))
|
||||
|
||||
@commands.cooldown(rate=1, per=5, type=commands.BucketType.user)
|
||||
@commands.command(description="PONG!", aliases=["pong"])
|
||||
|
||||
Reference in New Issue
Block a user