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

Valid channel check on all commands #48

Merged
merged 8 commits into from
Aug 27, 2024

Conversation

clockwinder
Copy link
Owner

@clockwinder clockwinder commented Aug 25, 2024

validChannel check reworked;
validChannel added to stop/whatson;
default Activity tweaked;
Bot prefix broken out to config file;

@clockwinder
Copy link
Owner Author

clockwinder commented Aug 25, 2024

Closes #10 #23 #44

rainwavebot.py Outdated Show resolved Hide resolved
@adamdiel
Copy link
Collaborator

Just printing this out as I'm trying this on the mac.

This is the stack dump I get after logging in and doing a rw.play chiptune. The music/radio is working right now but this showed up and I don't have a current playing chat message at the moment.

2024-08-26 20:28:58 ERROR    discord.ext.commands.bot Ignoring exception in command play
Traceback (most recent call last):
  File "/Users/adamdiel/github/rainwavediscordbot/rainwavebot.py", line 59, in postCurrentlyListening
    tempEmbed = nowPlayingEmbed(newMetaData)
  File "/Users/adamdiel/github/rainwavediscordbot/rainwavebot.py", line 115, in nowPlayingEmbed
    class formatedEmbed:
  File "/Users/adamdiel/github/rainwavediscordbot/rainwavebot.py", line 125, in formatedEmbed
    color = discord.Colour.from_rgb(options.embedColor[0],options.embedColor[1],options.embedColor[2]))
AttributeError: type object 'options' has no attribute 'embedColor'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/adamdiel/Library/Python/3.9/lib/python/site-packages/discord/ext/commands/core.py", line 235, in wrapped
    ret = await coro(*args, **kwargs)
  File "/Users/adamdiel/github/rainwavediscordbot/rainwavebot.py", line 238, in play
    await postCurrentlyListening(ctx)
  File "/Users/adamdiel/github/rainwavediscordbot/rainwavebot.py", line 71, in postCurrentlyListening
    traceback.print_exception()
NameError: name 'traceback' is not defined

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/adamdiel/Library/Python/3.9/lib/python/site-packages/discord/ext/commands/bot.py", line 1366, in invoke
    await ctx.command.invoke(ctx)
  File "/Users/adamdiel/Library/Python/3.9/lib/python/site-packages/discord/ext/commands/core.py", line 1029, in invoke
    await injected(*ctx.args, **ctx.kwargs)  # type: ignore
  File "/Users/adamdiel/Library/Python/3.9/lib/python/site-packages/discord/ext/commands/core.py", line 244, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'traceback' is not defined

@clockwinder
Copy link
Owner Author

clockwinder commented Aug 27, 2024

You're sure you're using the most recent config.py.example? Seems like you're missing the embed color option.

    #Allows selection of embed sidebar color as an (r, g, b) value.  
    #You can use https://it-tools.tech/color-converter to generate an rgb color value.
    embedColor = (24, 135, 210)

@adamdiel
Copy link
Collaborator

At least for me, line 72 wasn't working as written (probably my bad). Quick google search appeared we should be using trackeback2 for python3.

import traceback2

Then changed line 72 to be traceback2.print_exc(), I started getting the expected behavior for printing

postCurrentlyListening error: type object 'options' has no attribute 'embedColor'
Traceback (most recent call last):
  File "/Users/adamdiel/github/rainwavediscordbot/rainwavebot.py", line 60, in postCurrentlyListening
    tempEmbed = nowPlayingEmbed(newMetaData)
  File "/Users/adamdiel/github/rainwavediscordbot/rainwavebot.py", line 116, in nowPlayingEmbed
    class formatedEmbed:
  File "/Users/adamdiel/github/rainwavediscordbot/rainwavebot.py", line 126, in formatedEmbed
    color = discord.Colour.from_rgb(options.embedColor[0],options.embedColor[1],options.embedColor[2]))
AttributeError: type object 'options' has no attribute 'embedColor'
postCurrentlyListening error: type object 'options' has no attribute 'embedColor'
Traceback (most recent call last):
  File "/Users/adamdiel/github/rainwavediscordbot/rainwavebot.py", line 60, in postCurrentlyListening
    tempEmbed = nowPlayingEmbed(newMetaData)
  File "/Users/adamdiel/github/rainwavediscordbot/rainwavebot.py", line 116, in nowPlayingEmbed
    class formatedEmbed:
  File "/Users/adamdiel/github/rainwavediscordbot/rainwavebot.py", line 126, in formatedEmbed
    color = discord.Colour.from_rgb(options.embedColor[0],options.embedColor[1],options.embedColor[2]))
AttributeError: type object 'options' has no attribute 'embedColor'

@adamdiel
Copy link
Collaborator

Added my embedColor to the config and now we jammin

image

@clockwinder
Copy link
Owner Author

So do I need to chance the traceback to traceback2? Also, from what I'm seeing I can use traceback2.print_exception() for greater clarity, right?

@adamdiel
Copy link
Collaborator

There wasn't a traceback I could install but I could install the traceback2 successfully.

And yea looks like print_exc() is just some default values for print_exception according to the docs

Also look at the last line of 286. I don't think we are doing anything with the param we are passing in anymore :)

So yeah - the bugs I did find are not related to this PR directly. The channel restriction stuff all works great on my machine. Tested every flip I could

@clockwinder clockwinder merged commit 328f149 into main Aug 27, 2024
@clockwinder clockwinder deleted the validChannel-check-on-all-commands branch August 27, 2024 03:20
@clockwinder
Copy link
Owner Author

clockwinder commented Aug 27, 2024

Closes #10 #44 #23

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

Successfully merging this pull request may close these issues.

2 participants