Merge branch 'dev' into fix_invite

This commit is contained in:
2021-10-31 14:30:17 +01:00
committed by GitHub
3 changed files with 31 additions and 26 deletions
+25 -3
View File
@@ -1,6 +1,7 @@
import discord
from discord import ActivityType
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,20 +20,27 @@ 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", []))
self.invite_link: str = ""
slash_guilds = None
if len(self.config["slash_command_guilds"]) > 0:
slash_guilds = self.config["slash_command_guilds"]
super().__init__(
command_prefix=self.prefix_callable,
description=self.config["info"].get("description", ""),
description=self.config["info"]["description"],
case_insensitive=False,
fetch_offline_members=False,
intents=intents,
slash_commands=True,
slash_command_guilds=[227431704426446848],
slash_command_guilds=slash_guilds,
)
self.loop.create_task(self.async_init())
@@ -69,6 +77,20 @@ class ChristmasBot(commands.Bot):
colour_dict[name] = Color(int(color, 16))
return colour_dict
@tasks.loop(seconds=30)
async def update_status(self):
await self.wait_until_ready()
bot_prefix = self.config["prefixes"][0]
if self.rpc_is_help_message:
title = f"for {bot_prefix}connect | {bot_prefix}help"
activity = discord.Activity(name=title, type=ActivityType.watching)
else:
activity = discord.Activity(name="Some song", type=ActivityType.playing)
self.rpc_is_help_message = not self.rpc_is_help_message
await self.change_presence(activity=activity)
if __name__ == "__main__":
try:
+4 -15
View File
@@ -6,24 +6,14 @@ from discord.ext.commands import Context
import humanize
import datetime
import lavalink
from bot import ChristmasBot
from utils.EmbedGenerator import EmbedGenerator
from utils.paginator import HelpPaginator
class InformationCog(commands.Cog, name="Information"):
def __init__(self, bot: commands.Bot):
def __init__(self, bot: ChristmasBot):
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"])
@@ -53,8 +43,7 @@ class InformationCog(commands.Cog, name="Information"):
@commands.cooldown(rate=1, per=5, type=commands.BucketType.user)
async def invite(self, ctx: Context):
"""Gets the invite link!"""
link = f"https://discord.com/oauth2/authorize?client_id=643555373814382593&permissions=3230720&scope=bot%20applications.commands"
await EmbedGenerator.Message(ctx, "Add our bot to your server:", link)
await EmbedGenerator.Message(ctx, "Add our bot to your server:", self.bot.invite_link)
@commands.command(
name="wlinfo",
@@ -128,6 +117,6 @@ class InformationCog(commands.Cog, name="Information"):
await ctx.send(embed=embed)
def setup(bot: commands.Bot):
def setup(bot: ChristmasBot):
bot.remove_command("help")
bot.add_cog(InformationCog(bot))
+2 -8
View File
@@ -2,13 +2,6 @@
"token": "",
"owner_ids": [194545408960102400, 190875175460405249],
"prefixes": ["ck!"],
"database": {
"host": "",
"port": 3306,
"user": "",
"password": "",
"db": ""
},
"lavalink": {
"host": "",
"port": 2333,
@@ -23,5 +16,6 @@
"name": "CloudKid Radio",
"description": "A sample bot description"
},
"cogs": ["cogs.owner", "cogs.settings", "cogs.information", "cogs.music"]
"cogs": ["cogs.owner", "cogs.settings", "cogs.information", "cogs.music"],
"slash_command_guilds": []
}