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
What if my Intel CPU explodes??
14:20
Paul's Hardware
Рет қаралды 8 М.
Nastya and SeanDoesMagic
00:16
Nastya
Рет қаралды 34 МЛН
Mom's Unique Approach to Teaching Kids Hygiene #shorts
00:16
Fabiosa Stories
Рет қаралды 34 МЛН
Опасность фирменной зарядки Apple
00:57
SuperCrastan
Рет қаралды 11 МЛН
Looks realistic #tiktok
00:22
Анастасия Тарасова
Рет қаралды 106 МЛН
Why didn't the Angular team just use RxJS instead of Signals?
8:15
Joshua Morony
Рет қаралды 90 М.
Python Logging - Tutorial
15:02
Tech With Tim
Рет қаралды 155 М.
5 Tips For Object-Oriented Programming Done Well - In Python
16:08
Python Discord Music Bot - discord.py w/ Lavalink
20:42
Anson the Developer
Рет қаралды 38 М.
How to write a Discord Role Reaction Bot in Python w/ Discord.py
17:16
Anson the Developer
Рет қаралды 59 М.
Python: Making a Discord bot (Part 6: Unban)
10:30
Lucas
Рет қаралды 95 М.
Ой не могу 🤣❤️
0:33
Dragon Нургелды 🐉
Рет қаралды 2 МЛН
Would you recognize your soul mate by smell?
0:14
Den Done It
Рет қаралды 19 МЛН
The cat chose the right one 🥰🥳😸
0:32
Ben Meryem
Рет қаралды 45 МЛН