Making A Discord Bot In Python (Part 4: Cogs)

  Рет қаралды 17,787

Paradoxial

Paradoxial

Жыл бұрын

Hey! Today we are adding cogs to our Discord bot in python. Subscribe!
MY DISCORD: / discord
Music Credits:
- loner
- Revenge
- Letting Go
- Serenity
- sorry
- space ride
All music in this video are made by Prod. Riddiman! Check him out!
/ prodriddiman
ALL SONGS ARE IN ORDER ACCORDING TO THE VIDEO FROM START TO END.
Outro is the same song as the last one played!
Intro is made by somebody else on panzoid, only changed the music (Serenity - ProdRiddiman)
Outro is made by me :)

Пікірлер: 37
@paradoxial7665
@paradoxial7665 Жыл бұрын
Like my videos? Want to see more Discord.py content? Need help with your bot's code? Well what are you waiting for? Subscribe and enable notifications today! And don't forget to join my Discord Server! discord.com/invite/XcHQz8RaWJ
@Odd-Variety
@Odd-Variety 9 ай бұрын
Thanks man a lot i was strugling in creating cogs and your video solve all my issues in this regards.
@armorman3005
@armorman3005 11 ай бұрын
Thanks. I saw an outdated tutorial about cogs that was made before the code was made asynchronous and was wondering why nothing worked. You helped alot.
@Shreel-001
@Shreel-001 10 ай бұрын
hi could u help me out
@armorman3005
@armorman3005 10 ай бұрын
@@Shreel-001 sure, what do you need
@Shreel-001
@Shreel-001 10 ай бұрын
it whowsme some kid of error you can check below@@armorman3005 Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ext\commands\bot.py", line 941, in _load_from_module_spec setup = getattr(lib, 'setup') AttributeError: module 'cogs.Ping' has no attribute 'setup' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "c:\Users\Administrator\Desktop\Python bot\bot.py", line 22, in asyncio.run(bot()) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\asyncio unners.py", line 44, in run return loop.run_until_complete(main) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64_qbz5n2kfra8p0\lib\asyncio\baseevents.py", line 649, in run_until_complete return future.result() File "c:\Users\Administrator\Desktop\Python bot\bot.py", line 19, in bot await load() File "c:\Users\Administrator\Desktop\Python bot\bot.py", line 15, in load await client.load_extension(f"cogs.{filename[:-3]}") File "C:\Users\Administrator\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ext\commands\bot.py", line 1013, in load_extension await self._load_from_module_spec(spec, name) File "C:\Users\Administrator\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ext\commands\bot.py", line 944, in _load_from_module_spec raise errors.NoEntryPointError(key) discord.ext.commands.errors.NoEntryPointError: Extension 'cogs.Ping' has no 'setup' function.
@imthesrpina
@imthesrpina 11 ай бұрын
thanks
@vip_bimmervip_bimmer8033
@vip_bimmervip_bimmer8033 Жыл бұрын
How should can I forward the original messages into a string?
@ainnunhere
@ainnunhere Жыл бұрын
Doesn’t do anything for me it doesn’t load my bot idk why
@matyiszabados
@matyiszabados 9 ай бұрын
For me it sais the system doesnt find the path to ' ./cogs ' . What do I do?
@ramosswq
@ramosswq Жыл бұрын
How do I use app commands and cogs
@volefy
@volefy 7 ай бұрын
it raised an error saying asyncio is not defined?
@anamzakir-gi3zc
@anamzakir-gi3zc Жыл бұрын
im the 800th subscriber
@turtlebear4900
@turtlebear4900 Жыл бұрын
does it matter where I put each @ code? like should it be before my commands or like on the bottom?
@HDisky
@HDisky 9 ай бұрын
@ ALWAYS has to be at top before "async def function():" my man
@Racovik_
@Racovik_ 10 ай бұрын
my bot does not respond to commands
@rowella7807
@rowella7807 Жыл бұрын
and we're gonna type in commands.cog.. and we're gonna type in DEATH 7:24
@bigtomDW
@bigtomDW Жыл бұрын
so to be clear COGS is another way of doing OOP within the discord module?
@paradoxial7665
@paradoxial7665 Жыл бұрын
You could... But it’s main function is just to offer clean organization of your commands, events, other code, etc…
@Cheesyass8755
@Cheesyass8755 Жыл бұрын
I am using 2 cogs what should i do to load both of them 🙁🙁
@paradoxial7665
@paradoxial7665 Жыл бұрын
if both of the cog files end with ".py" AND they are set up how they are supposed to be, then python along with discord.py will load both of them up!
@Rustanovich
@Rustanovich 4 ай бұрын
bot doesn't responding
@omerakbu1t
@omerakbu1t Жыл бұрын
i get that error: File main.py, line 20, in main async with bot: TypeError: 'Bot' object does not support the asynchronous context manager protocol
@DaRealBlueCow
@DaRealBlueCow 11 ай бұрын
same here, idk how to fix it
@BestEli
@BestEli Жыл бұрын
whats the point of cogs?
@fipium
@fipium Жыл бұрын
im not an expert and i am still learning, but from my general understanding, cogs are a way to not only organize and sort your commands and other stuff, but i believe it allows you to edit the commands and reload the cogs without having to restart the bot entirely.
@nwchef
@nwchef Жыл бұрын
@@fipium do u think i should start learning and using them from the start when making a bot
@fipium
@fipium Жыл бұрын
@@nwchef from my understanding, cogs allow you to make changes and i think add new commands and code without having to completely restart the entire bot. if i understand that correctly, then yes absolutely worth to learn. itll also allow your code to be more organized and clean
@strawhatonpc4008
@strawhatonpc4008 Жыл бұрын
It says “./cogs” not found
@ooogaboooga8065
@ooogaboooga8065 Жыл бұрын
Try just cogs
@tacocat8829
@tacocat8829 Жыл бұрын
I changed mine to include the name of the file that contains the project: "./Folder/cogs"
@dorukaltan4264
@dorukaltan4264 Жыл бұрын
l cant see command can you help me pleas
@walanyo480
@walanyo480 Жыл бұрын
I actually understand everything in the video, but i keep on getting: ModuleNotFoundError: No module named 'cogs' My code (thats relevant): async def load(): for filename in os.listdir("./cogs"): if filename.endswith(".py"): print(filename) print(f"cogs.{filename[:-3]}") await client.load_extension(f"cogs.{filename[:-3]}") #ERROR ON THIS LINE # print(filename[:-3], "has loaded") A couple of other ppl have had this as well, would be helpful if you responded :)
@screamlaps7857
@screamlaps7857 Жыл бұрын
still need help?
@Akkkikkoo
@Akkkikkoo Жыл бұрын
@@screamlaps7857 yes
@screamlaps7857
@screamlaps7857 Жыл бұрын
@@Akkkikkoo you need to write not only the cogs folder .you need to write the folder where the cogs folder is in too, like this: for filename in os.listdir(".\discord_bot\cogs"):
Making a Discord Bot In Python (Part 5: Embeds)
11:50
Paradoxial
Рет қаралды 9 М.
Create a Music Discord bot using Python
16:46
Computeshorts
Рет қаралды 113 М.
Stay on your way 🛤️✨
00:34
A4
Рет қаралды 22 МЛН
How Many Balloons Does It Take To Fly?
00:18
MrBeast
Рет қаралды 193 МЛН
World’s Largest Jello Pool
01:00
Mark Rober
Рет қаралды 87 МЛН
ЧУТЬ НЕ УТОНУЛ #shorts
00:27
Паша Осадчий
Рет қаралды 10 МЛН
Create a Discord Music Bot with a Queue in Python [2024]
17:33
Ethan | The Code Syndicate
Рет қаралды 4,3 М.
How To Build A Trading Bot In Python
18:46
CodeTrading
Рет қаралды 734 М.
Make a Discord Bot with Slash Commands
11:07
Ethan | The Code Syndicate
Рет қаралды 3 М.
Code a Discord Bot with Python - Host for Free in the Cloud
1:08:28
freeCodeCamp.org
Рет қаралды 2,3 МЛН
What is Python's Main Function Useful For?
8:08
NeuralNine
Рет қаралды 74 М.
[NEW] Slash Commands in Less than 10 Minutes Using Discord.PY
5:55
СПЕЦАГЕНТ ПРОТИВ ПРИЗРАКА ► Chaperone
43:56
Kuplinov ► Play
Рет қаралды 707 М.