Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoneType' object has no attribute 'text_channels' #61

Closed
peter-russell opened this issue Nov 2, 2018 · 6 comments
Closed

Comments

@peter-russell
Copy link

peter-russell commented Nov 2, 2018

When a DM is sent to the bot, it emoji reacts with ✅, but the message isn't being displayed as a channel in the server. The bot-info channel is available, though. The following error(s) keep occurring in Heroku when a message is sent to the bot.

2018-11-02T11:08:38.395920+00:00 app[worker.1]: Ignoring exception in on_message
2018-11-02T11:08:38.396107+00:00 app[worker.1]: Traceback (most recent call last):
2018-11-02T11:08:38.396163+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/discord/client.py", line 225, in _run_event
2018-11-02T11:08:38.396167+00:00 app[worker.1]: await coro(*args, **kwargs)
2018-11-02T11:08:38.396173+00:00 app[worker.1]: File "bot.py", line 382, in on_message
2018-11-02T11:08:38.396175+00:00 app[worker.1]: await self.process_modmail(message)
2018-11-02T11:08:38.396179+00:00 app[worker.1]: File "bot.py", line 353, in process_modmail
2018-11-02T11:08:38.396182+00:00 app[worker.1]: channel = discord.utils.get(guild.text_channels, topic=topic)
2018-11-02T11:08:38.396239+00:00 app[worker.1]: AttributeError: 'NoneType' object has no attribute 'text_channels'

@peter-russell
Copy link
Author

@fourjr

@Celtics2034
Copy link

Have you figured out a solution for this? I am having the same issue. @peter-russell

@peter-russell
Copy link
Author

No, still doesn't work. @Celtics2034

@peter-russell
Copy link
Author

@4rqm

@csojinb
Copy link
Contributor

csojinb commented Nov 22, 2018

So, I looked into this, the issue appears to be that the bot is not correctly picking up the GUILD_ID from the env variable. I haven't figured out why that is, but I have confirmed that deploying it with the GUILD_ID hardcoded here seems to work just fine.

@kyb3r
Copy link
Collaborator

kyb3r commented Nov 29, 2018

@csojinb this actually only happens if you added the bot to the server after you started it. This is because when the bot starts it checks the guilds that it currently is in, and finds the guild from the provided guild_id and stores it in self.guild. So if you start the bot before you added the stored attribute is set to None. I fixed this issue just now by making self.guild a property.

@kyb3r kyb3r closed this as completed Nov 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants