import os import random import discord intents = discord.Intents.all() from dotenv import load_dotenv from discord.ext import commands, tasks from cogwatch import Watcher prefix = "u!" load_dotenv() TOKEN = os.getenv("DISCORD_TOKEN") GAME = os.getenv("DISCORD_GAME") client = commands.Bot(command_prefix=prefix, intents=intents, help_command=None) @client.event async def on_ready(): await client.change_presence(status=discord.Status.dnd, activity=discord.Activity(type=discord.ActivityType.watching, name="Nobody else cares, but WE do!!!")) print(f'{client.user} is up running phinbot') watcher = Watcher(client, path='cogs', preload=True, debug=False) await watcher.start() await change_avatar.start() class MyHelp(commands.HelpCommand): async def send_bot_help(self, mapping): """ This is triggered when !help is invoked. This example demonstrates how to list the commands that the member invoking the help command can run. """ filtered = await self.filter_commands(self.context.bot.commands, sort=True) # returns a list of command objects names = [command.name for command in filtered] # iterating through the commands objects getting names available_commands = "\n".join(names) # joining the list of names by a new line embed = discord.Embed(title="Knee Help Command", color=0xbb00ff, description=f'```{available_commands}```\nDo u!help for more info on a command.') await self.context.reply(embed=embed) async def send_command_help(self, command): embed = discord.Embed(title=self.get_command_signature(command), color=0xbb00ff) embed.add_field(name="Help", value=command.help) alias = command.aliases if alias: embed.add_field(name="Aliases", value=", ".join(alias), inline=False) channel = self.get_destination() await channel.send(embed=embed) async def send_group_help(self, group): """This is triggered when !help is invoked.""" await self.context.send("how the hell are you even seeing this") async def send_cog_help(self, cog): """This is triggered when !help is invoked.""" await self.context.send("abababababa") async def send_error_message(self, error): """If there is an error, send a embed containing the error.""" channel = self.get_destination() # this defaults to the command context channel await channel.send(error) client.help_command = MyHelp() @tasks.loop(minutes=10) async def change_avatar(): base_pfps = [ 'silly', 'c3-1', 'c3-2', 'c3-3', 'c3-4', 'c3-5', 'c3-6', 'c4-1' ] pfp_choice = random.choice(base_pfps) pfp_format = f'pfp/{pfp_choice}.png' with open(f'{pfp_format}', 'rb') as image: await client.user.edit(avatar=image.read()) print(f'Current PFP: {pfp_format}') @client.event async def on_command_error(ctx, error): embed=discord.Embed(title="Shit! An error occurred:", description=f"{error}", color=0xff0000) await ctx.send(embed=embed) @client.event async def on_message(message): if message.author == client.user: return # Check if the message contains the word "crazy" if "<@1121937985772982385>" in message.content.lower(): await message.channel.send(f"My prefix is `{prefix}`, bro") await client.process_commands(message) client.run(TOKEN)