Making a Discord Bot | Part 10: Cogs | Discord.py 2.0

  Рет қаралды 25,309

Civo

Civo

2 жыл бұрын

In todays video I tell you how to use cogs in discord.py 2.0 hope you guys enjoy.
============= Links =============
Discord.py 2.0 - pip install git+github.com/Rapptz/discord.py
Discord Developer - / discord .
Main Channel - / civoprohd
#discord #discordpy #coding

Пікірлер: 42
@delafossejoris7712
@delafossejoris7712 Жыл бұрын
Man thank you sooooooooo much, I've been trying to load cogs for hours and hours following many other tutorials, none of them worked, and your video saved me ! thank you
@IndiMops
@IndiMops Жыл бұрын
Dude, thank you. I watched different videos/articles and did not help their advice, but by your tips, the code was working
@andreasgamer8036
@andreasgamer8036 8 ай бұрын
Ong
@MacAlmighty
@MacAlmighty 9 ай бұрын
Ah, I hadn't added the setup function at the end of my cogs, now it works like a charm. Cheers!
@leg9
@leg9 6 ай бұрын
Thank you so much for making this video! Now my code is so much more organized!
@lapispheonix7569
@lapispheonix7569 Жыл бұрын
Thank you so much! This is the only video that has worked for me!!!
@esterribeiro6836
@esterribeiro6836 Жыл бұрын
You saved my project, great content!
@official_allstoneyt
@official_allstoneyt 2 жыл бұрын
Cool
@AndersonAlves.
@AndersonAlves. 11 ай бұрын
Thank you very much. You helped me a lot with this video. Success.
@Fury2op
@Fury2op 8 ай бұрын
print(f'Congratulations you won a new {subscriber}')
@RoLm.
@RoLm. 10 ай бұрын
it works dude ty
@chromonium
@chromonium 11 ай бұрын
thanks for the help civo, but i have one question how can i make it load from every single other folder in the cogs folder? asking so i can organise my bot even better
@endofb93
@endofb93 Жыл бұрын
how would i define the bot where u do prefix and intents
@Tomqnto
@Tomqnto Жыл бұрын
how to make it like we can load/reload/unload cogs?
@Alanium-MC
@Alanium-MC 2 жыл бұрын
Finally a video that actually explains everything and it works! Tysmmmm. Could you also make a video on how to put in a custom help command in discord py v2? I tried using this method of loading cog to load my help command cog and it didnt work. Thanks a lot again!! Loved the video
@CivoCode
@CivoCode 2 жыл бұрын
I made a video on sub commands which should help you
@Alanium-MC
@Alanium-MC 2 жыл бұрын
@@CivoCode yeah, i did see that, but I'm trying to find a help command that doesnt manually require me to type out each command and instead just automates the process. The code i was using is class HelpCommand(commands.HelpCommand): colour = 0x0dd2ff @commands.Cog.listener() async def on_ready(self): print("Cog loaded - HelpCommand.py") def footer(self): return f"{self.clean_prefix}{self.invoked_with} [command] for more information" def get_command_signature(self, command): return f"```{self.clean_prefix}{command.qualified_name} {command.signature}```" async def send_cog_help(self, cog): embed = discord.Embed(title=f"**{cog.qualified_name}** commands", colour=self.colour) if cog.description: embed.description = cog.description filtered = await self.filter_commands(cog.get_commands(),sort=True) for command in filtered: embed.add_field(name=command.qualified_name, value=command.short_doc or "No description") embed.set_footer(text=self.footer()) await self.get_destination().send(embed=embed) async def send_command_help(self, command): embed = discord.Embed(title=command.qualified_name, colour=self.colour) if command.help: embed.description = command.help embed.add_field(name="Signature", value=self.get_command_signature(command)) embed.set_footer(text=self.footer()) await self.get_destination().send(embed=embed) async def send_bot_help(self, mapping): embed = discord.Embed(title="Bot Commands", colour=self.colour) description = self.context.bot.description if description: embed.description = description for cog, commands in mapping.items(): if not cog: continue filtered = await self.filter_commands(commands, sort=True) if filtered: value = "\t".join(f"`{i.name}`"for i in commands) embed.add_field(name=cog.qualified_name, value=value) embed.set_footer(text=self.footer()) await self.get_destination().send(embed=embed) def setup(bot): bot.help_command = HelpCommand()
@wafflebutsad
@wafflebutsad Жыл бұрын
please update the playlist in your channel, would be easier for your viewers to access. it only has the first 5 from the series currently
@creamsn3
@creamsn3 Жыл бұрын
the cogs are working but I can't see any error how to fix this???
@akalpozkidirir2059
@akalpozkidirir2059 Ай бұрын
how to do it with app commands aka slash commands?
@FukurouYGR
@FukurouYGR 4 ай бұрын
Hi. I followed the video but now my commands are duplicated? for example when I say !hello, it prints the message two times, anyone has any idea why?
@atomizedbassist
@atomizedbassist 4 ай бұрын
you have two instances running
@Ehan981
@Ehan981 8 ай бұрын
TYSM!!!!!!!
@shihab4283
@shihab4283 2 жыл бұрын
how i can add reaction
@welshtony1
@welshtony1 Жыл бұрын
Copied exactly as shown but getting this error [WinError 3] The system cannot find the path specified: './cogs' Using 64bit python 3.8.10 ig that makes a difference. Any ideas?
@Ghosty2004
@Ghosty2004 Жыл бұрын
ye i got the same problem
@ozankutlu9282
@ozankutlu9282 Жыл бұрын
try ".\\cogs"
@FlockersDesign
@FlockersDesign Жыл бұрын
some how the bot.load_extension gives a error bot is not defiend i dont get it look over it 3 times
@pixel8596
@pixel8596 Жыл бұрын
probably cuz you named your bot 'client' and not 'bot'
@guepard9460
@guepard9460 Жыл бұрын
@@FlockersDesign is it like await is outside function?
@FlockersDesign
@FlockersDesign Жыл бұрын
@@guepard9460 na i was just a idiot i use client not bot at this point i was programming for over 12 hours after a good sleep and coffe i saw it
@guepard9460
@guepard9460 Жыл бұрын
@@FlockersDesign Client and bot is the same things. Its commands.Bot or Discord.Bot that makes the difference
@FlockersDesign
@FlockersDesign Жыл бұрын
@@guepard9460 nope this is not correct
@kitler4650
@kitler4650 Жыл бұрын
I did this, but the cog returns NoneType, what did I do wrong?
@user-wc5xe2jr7j
@user-wc5xe2jr7j Жыл бұрын
I have the same question.... did you solve it?
@jbingbao
@jbingbao Жыл бұрын
@@user-wc5xe2jr7j i got this same error, you have to remove the async and await from the setup in the cog file and also remove await when loading the extension
@IsaacDeveloper292
@IsaacDeveloper292 7 ай бұрын
4:52
@sekkyzv.3190
@sekkyzv.3190 2 жыл бұрын
Hello Civo! Can you do a boost bot? I need like 7boosts for my server, good luck!
@CivoCode
@CivoCode 2 жыл бұрын
If you mean Nitro boost you cant do that, as its a bot and can't have Nitro
Python Discord Bot - How to use Cogs [discord.py]
21:53
Anson the Developer
Рет қаралды 23 М.
Inside Out 2: Who is the strongest? Joy vs Envy vs Anger #shorts #animation
00:22
КАК ДУМАЕТЕ КТО ВЫЙГРАЕТ😂
00:29
МЯТНАЯ ФАНТА
Рет қаралды 10 МЛН
Smart Sigma Kid #funny #sigma #comedy
00:40
CRAZY GREAPA
Рет қаралды 9 МЛН
Making a Discord Bot | Part 4: Embeds | Discord.py 2.0
6:52
#programming #programmer #love
0:19
Atharva Joshi
Рет қаралды 76
How To Code a Discord Music Bot
6:10
Max Codez
Рет қаралды 228 М.
Make a Discord Bot with Slash Commands
11:07
Ethan | The Code Syndicate
Рет қаралды 3 М.
Kumanda İle Bilgisayarı Yönetmek #shorts
0:29
Osman Kabadayı
Рет қаралды 2,2 МЛН
8 Товаров с Алиэкспресс, о которых ты мог и не знать!
49:47
РасПаковка ДваПаковка
Рет қаралды 166 М.
Todos os modelos de smartphone
0:20
Spider Slack
Рет қаралды 63 МЛН
S24 Ultra and IPhone 14 Pro Max telephoto shooting comparison #shorts
0:15
Photographer Army
Рет қаралды 10 МЛН