extension titleRequest does not have a setup function #2979
Labels
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Mrcoolgamer11/Red-DiscordBot#2979
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Command bugs
Command name
!load "cogname"
What cog is this command from?
Custom cog created by manual:
https://red-discordbot.readthedocs.io/en/latest/guide_cog_creation.html#getting-started
What were you expecting to happen?
I'd like to see "I can do stuff"
What actually happened?
Got an error in Terminal:
Traceback (most recent call last): n load_extension
File "d:\programs\python 3.7.4\lib\site-packages\redbot\core\core_commands.py", l")ine 106, in _load on
await bot.load_extension(spec)
File "d:\programs\python 3.7.4\lib\site-packages\redbot\core\bot.py", line 296, in load_extension
raise discord.ClientException(f"extension {name} does not have a setup function")
discord.errors.ClientException: extension titleRequest does not have a setup function
How can we reproduce this issue?
init.py
from .titleRequest import TitleRequest
def setup(bot):
bot.add_cog(TitleRequest())
titleRequest.py
from redbot.core import commands
class TitleRequest(commands.Cog):
"""My custom cog"""
Can you please give me a hint on what am I doing wrong?
sounds like your folder structure is probably wrong should look something like this. For more help you should join the discord as we can help you easier there with coding your own cog
Without a bit more info, it's a bit difficult to be able to say. The above suggestion about folder structure is a good place to check.
Red attempts to import a module, then looks for a function named
setupin that module.If Red says the function isn't there, it isn't, but this can be caused by multiple things.
We have a dedicated channel in the discord server for help with writing cogs if you are still having issues after this.
I found the solution which isn't really a user error.
Apparently the folder structure should look like this if you want to add a new cog and run it:
.
└── folder_with_cogs
└── mycog
└── mycog
├──init.py
└── mycog.py
While my [p]paths has output like this: "..folder_with_cogs\mycog"
This is a BUG.
..folder_with_cogsshould be the folder you add with[p]addpathand notfolder_with_cogs\mycog