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

  Рет қаралды 26,263

Civo

Civo

Күн бұрын

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/Rap...
Discord Developer - / discord .
Main Channel - / civoprohd
#discord #discordpy #coding

Пікірлер: 43
@itsaname3986
@itsaname3986 22 күн бұрын
This helped show a good demonstration of cogs in a really concise manner. Really great video thank you so much!
@IndiMops
@IndiMops 2 жыл бұрын
Dude, thank you. I watched different videos/articles and did not help their advice, but by your tips, the code was working
@andreasgamer8036
@andreasgamer8036 11 ай бұрын
Ong
@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
@MacAlmighty
@MacAlmighty 11 ай бұрын
Ah, I hadn't added the setup function at the end of my cogs, now it works like a charm. Cheers!
@Fury2op
@Fury2op 10 ай бұрын
print(f'Congratulations you won a new {subscriber}')
@leg9
@leg9 9 ай бұрын
Thank you so much for making this video! Now my code is so much more organized!
@chromonium
@chromonium Жыл бұрын
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
@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
@esterribeiro6836
@esterribeiro6836 Жыл бұрын
You saved my project, great content!
@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"
@lapispheonix7569
@lapispheonix7569 2 жыл бұрын
Thank you so much! This is the only video that has worked for me!!!
@FukurouYGR
@FukurouYGR 7 ай бұрын
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 6 ай бұрын
you have two instances running
@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
@WarCodeNexus
@WarCodeNexus 2 жыл бұрын
Cool
@AndersonAlves.
@AndersonAlves. Жыл бұрын
Thank you very much. You helped me a lot with this video. Success.
@IsaacDeveloper292
@IsaacDeveloper292 10 ай бұрын
4:52
@RoLm.
@RoLm. Жыл бұрын
it works dude ty
@akalpozkidirir2059
@akalpozkidirir2059 4 ай бұрын
how to do it with app commands aka slash commands?
@Ehan981
@Ehan981 10 ай бұрын
TYSM!!!!!!!
@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?
@creamsn3
@creamsn3 Жыл бұрын
the cogs are working but I can't see any error how to fix this???
@FlockersDesign
@FlockersDesign 2 жыл бұрын
some how the bot.load_extension gives a error bot is not defiend i dont get it look over it 3 times
@pixel8596
@pixel8596 2 жыл бұрын
probably cuz you named your bot 'client' and not 'bot'
@guepard9460
@guepard9460 2 жыл бұрын
@@FlockersDesign is it like await is outside function?
@FlockersDesign
@FlockersDesign 2 жыл бұрын
@@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 2 жыл бұрын
@@FlockersDesign Client and bot is the same things. Its commands.Bot or Discord.Bot that makes the difference
@FlockersDesign
@FlockersDesign 2 жыл бұрын
@@guepard9460 nope this is not correct
@shihab4283
@shihab4283 2 жыл бұрын
how i can add reaction
@ExpectoPetroleum
@ExpectoPetroleum Жыл бұрын
I did this, but the cog returns NoneType, what did I do wrong?
@777-e4q5b
@777-e4q5b Жыл бұрын
I have the same question.... did you solve it?
@jbingbao
@jbingbao Жыл бұрын
@@777-e4q5b 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
Replace Is Number Saves 440GB A WEEK
9:54
ThePrimeagenClips
Рет қаралды 245 М.
啊?就这么水灵灵的穿上了?
00:18
一航1
Рет қаралды 30 МЛН
Inside Out 2: ENVY & DISGUST STOLE JOY's DRINKS!!
00:32
AnythingAlexia
Рет қаралды 17 МЛН
I Used Code to Go Viral on Social Media
8:54
Green Code
Рет қаралды 238 М.
The Ultimate Tier Programming Tier List | Prime Reacts
26:57
ThePrimeTime
Рет қаралды 435 М.
Level Up your Discord Server with Onboarding
13:16
No Text To Speech
Рет қаралды 490 М.
САМЫЕ ОПАСНЫЕ ЛЕГО КОРАБЛИ
9:15
niklax
Рет қаралды 111 М.
Building a Discord Bot in Python (2024) Episode Four: Cogs
10:20
Paradoxial
Рет қаралды 3,5 М.
@PirateSoftware  explains kernel level anticheat
4:52
DJSuperPanda
Рет қаралды 61 М.
I made my own Code Editor
12:02
FaceDev
Рет қаралды 309 М.
5 Good Python Habits
17:35
Indently
Рет қаралды 559 М.
Последствия выхода Айфона 16
0:23
ТРЕНДИ ШОРТС
Рет қаралды 6 МЛН
Apple designers updating the iPhone design 😂
0:13
Createwithfid
Рет қаралды 1,4 МЛН