Python Discord Bot - How to use Cogs [discord.py]

  Рет қаралды 23,702

Anson the Developer

Anson the Developer

4 жыл бұрын

In this video, we're going to take a look at Cogs, what they are, why they're useful, and how to implement them. Cogs are great for grouping all events, commands, etc. to their main context. For example, we can have a cog that groups all Administrator commands, or a cog that handles reaction events, or a cog that handles command errors, and a bunch more.
Discord: / discord

Пікірлер: 44
@aimenbarigoudz
@aimenbarigoudz 3 жыл бұрын
Thanks man, I learned how to implement them purely because people were recommending it, but didnt know what I would use them for, thanks for explaining so well :)
@kwt3257
@kwt3257 3 жыл бұрын
this guy deserves way more hype then he actually gets, that was the BEST tutorial ive seen in my entire life
@longtoZ
@longtoZ 4 жыл бұрын
Thanks for explaining so clearly ;)
@timothysalazar6689
@timothysalazar6689 4 жыл бұрын
Awesome video, helped me out a lot. Thanks
@halbgefressen9768
@halbgefressen9768 4 жыл бұрын
Nice tutorial! Well explained and prepared.
@voltagent762
@voltagent762 2 жыл бұрын
you r really good at what you do and your explaining was ferry nice 👍
@mk9834
@mk9834 4 жыл бұрын
Thanks a ton bro!
@DanielAgafonov
@DanielAgafonov 4 жыл бұрын
VERY good tutorial
@memedank7068
@memedank7068 3 жыл бұрын
this dude is a legend
@Dinhjason
@Dinhjason 4 жыл бұрын
Extremely well done. Thank you so much.
@Lumiobyte
@Lumiobyte 4 жыл бұрын
fiire vid anson dev
@DiscordCriminal
@DiscordCriminal 3 жыл бұрын
i cant get cogs to work at all no matter what video i watch or how much i read i always get an error of some kind whats wrong with this command @commands.Cog.listener() async def hello(self, ctx): await ctx.send("hello") it tells me command: hello is not found and if i try and launch my bot it says i already loaded the cog and wont launch
@localbreadfan
@localbreadfan 3 жыл бұрын
you're using a listener this will trigger like an event, if you want to do a command you have to do: @commands.command() async def hello(self, ctx) await ctx.send("hello")
@ishaanagrawal3575
@ishaanagrawal3575 3 жыл бұрын
Whenever I try to run the code it says: ModuleNotFoundError: No module named 'cogs' And that error comes from the load_extension
@frankiemarrocco6462
@frankiemarrocco6462 3 жыл бұрын
im also getting this, i think they might have updated the library after this video was released, the docs don't say anything about a setup() function either
@ishaanagrawal3575
@ishaanagrawal3575 3 жыл бұрын
@@frankiemarrocco6462 I was able to find a solution to this. All I had to do was but my cog files into a folder named cogs
@besambal9378
@besambal9378 3 жыл бұрын
slow TF down! further Awsome work on the tutorial!
@VortexVolt
@VortexVolt 3 жыл бұрын
ye
@shrek2115
@shrek2115 4 жыл бұрын
Pls do some new tutorial of discord.py
@ethitlan
@ethitlan 3 жыл бұрын
I'm not sure if you are going to reply to this but, is this async or rewrite?
@joebyjo
@joebyjo 3 жыл бұрын
the command ypu were looking for is os.listdir('cogs')
@galaxycube1016
@galaxycube1016 4 жыл бұрын
ctrl+f ban’ Boom found the command
@frostiiify9505
@frostiiify9505 3 жыл бұрын
That's what I do xD
@Evan.C24
@Evan.C24 4 жыл бұрын
you dont seem to reply to these. But how can i add an alias to a cog? i tried just inserting aliases=['name1', 'name2'] but as soon as 'name2' is added the command breaks?
@ansonthedev
@ansonthedev 4 жыл бұрын
I'm not sure what you did exactly, but if you want, join our Discord server for better help. The link is in the description.
@DiscordCriminal
@DiscordCriminal 3 жыл бұрын
Aliases=[‘example 1’ , ‘example 2’, ‘example 3’]
@TheHippyHoppyHippo
@TheHippyHoppyHippo 3 жыл бұрын
I keep getting an error that "__init__ must be a coroutine"
@terabyte.9774
@terabyte.9774 3 жыл бұрын
use "await __init__"
@TheHippyHoppyHippo
@TheHippyHoppyHippo 3 жыл бұрын
@@terabyte.9774 ok
@VanValdenburg
@VanValdenburg 4 жыл бұрын
OK
@hackzislife2089
@hackzislife2089 4 жыл бұрын
No module named 'cogs' pls help.
@alrifat9419
@alrifat9419 4 жыл бұрын
it's cog, not cogs
@cypher_guy3752
@cypher_guy3752 4 жыл бұрын
@@alrifat9419 Still doesn't work for me
@azoicxx
@azoicxx 3 жыл бұрын
Try adding this at the end of the main file: // for filename in os.listdir('./cogs'): if filename.endswith('.py'): client.load_extension(f'cogs.{filename[:-3]}') //
@MitsuoRLCoach
@MitsuoRLCoach 4 жыл бұрын
no link in the description for docs about cogs
@ansonthedev
@ansonthedev 4 жыл бұрын
Mitsuo you can easily google it
@MitsuoRLCoach
@MitsuoRLCoach 4 жыл бұрын
@@ansonthedev ive tried the way you reference your cogs in your bot script and when i run the bot script it opens and instantly closes
@codingcuber
@codingcuber 4 жыл бұрын
@@MitsuoRLCoach Error in your code bro open it in idle and identify the error and solve
@ExpandedCuber
@ExpandedCuber 3 жыл бұрын
you sound like a python version of CodeLyon to
@Yguy
@Yguy 3 жыл бұрын
Why do you sound so much like Sentdex... Lmao
@daniyalrai527
@daniyalrai527 3 жыл бұрын
__init__
@jasperzanjani
@jasperzanjani 3 жыл бұрын
miskellaneous
Python: Making a Discord bot (Part 7: Cogs)
22:55
Lucas
Рет қаралды 200 М.
Clown takes blame for missing candy 🍬🤣 #shorts
00:49
Yoeslan
Рет қаралды 43 МЛН
🤔Какой Орган самый длинный ? #shorts
00:42
Python Discord Music Bot - discord.py w/ Lavalink
20:42
Anson the Developer
Рет қаралды 38 М.
Discord.py - XP Leveling System Tutorial
26:43
Anson the Developer
Рет қаралды 11 М.
Simple Code, High Performance
2:50:14
Molly Rocket
Рет қаралды 240 М.
The moment we stopped understanding AI [AlexNet]
17:38
Welch Labs
Рет қаралды 814 М.
Python Discord Bot - Groups & Subcommands
8:58
Anson the Developer
Рет қаралды 10 М.
EASY! Organize Your Messy Code Using COGS! (Ep. 13)
16:36
sanamo
Рет қаралды 13 М.
How to write a Discord Role Reaction Bot in Python w/ Discord.py
17:16
Anson the Developer
Рет қаралды 59 М.
Python Discord Bot - Permissions & Checks
12:40
Anson the Developer
Рет қаралды 27 М.
Старший брат хотел ее защитить 😭🥺😱 #shorts
0:37
Фильм про побег от родителей
0:59
Holy Baam
Рет қаралды 2,1 МЛН
ToRung short film: i sell watermelon🍉
0:38
ToRung
Рет қаралды 21 МЛН
小蚂蚁那么小气干嘛!#火影忍者 #佐助 #家庭
0:26
火影忍者一家
Рет қаралды 6 МЛН
Вилка для консервов 🥒
0:51
Сан Тан
Рет қаралды 3 МЛН
A young mother couldn't calm down her baby at the lesson #shorts
0:32
Fabiosa Best Lifehacks
Рет қаралды 14 МЛН