Cannot use commands and events together in discord bot - discord

Source, (Forgive my possible spaghetti code, I am not that good) I am trying to add commands on this old code that I made a while back and the commands through events work just fine but the actual proper commands do not work.
Please could I get some tips or help?
Here is the source https://repl.it/#DontSniffSugar/DiscordBot#main.py

The issue in your code is that you didn't process the commands. When overwriting the default on_message event you also have to process them.
#client.event
async def on_message(message):
# ...
await client.process_commands(message)
Also a small note for the future, don't post links to your code, the code should be in the question itself. Also you should enable some intents, if you don't what that is and how to enable them, take a look at the introduction
Reference:
Bot.process_commands

Related

Make both Guild Command and Global Command work together Discord.js v13?

I'm trying to make slash command on my bot by following Discordjs Guide. According to this, there are guild command (only work on some servers) and global command (work on all servers have the bot).
But I just can make guild or global command work only, not both.
So is there anyway to make both of it work together?
For example: I have 2 slash command: cmd_1 and cmd_2,
i want to make cmd_1 globally and cmd_2 only for my server.
Sorry for my bad English.
You can just deploy cmd_1 globally and cmd_2 to your desired server. Take a look here on how to add a command to a guild and here to add a command globally. The only difference really is if you either use the applicationGuildCommands or the applicationCommands method. The former is the method to add commands to one guild only whilst the latter is used to push commands globally.

discord.js Commando custom help command

Is there any possible way to make the discord commando send a message in chat instead of dm's when doing the !help command for example.
I want to keep it with commando framework since it's easy to make commands with it and I like how you can do !help "command" and get details about that one command, but what I don't like is that it sends it all in to your dm's, and I want to have it in my discord server and some people have their dm's off too which is another problem. Is there any way to make it so that it sends in the normal chat instead?
Try to disable built in help command follow the docs and build your own help commands
In case you need help commands source of commando is here
bot.registry
.registerDefaultTypes()
.registerDefaultGroups()
.registerDefaultCommands({
help: true,
prefix: false,
eval: false,
ping: true,
commandState: false,
unknownCommand: false
});
Obviously you can specify the channel to send the command in (DM is a channel too). The fact that you ask this question implies you have just started learning coding / using discord.js.
Stack Overflow is not your personal Google / won't write code for you, come back once you have actual questions (read this to learn how to make good questions related to this site).
Enjoy your coding!

A problem with lavalink discord example cog

I'm using the example cog of discord.py lavalink, and I'm having an error "AttributeError: 'NoneType' object has no attribute 'id'"
I've already installed lavalink, and not sure what is causing this.
I've check around for other posts who may have similar issues and couldn't find any.
https://github.com/Devoxin/Lavalink.py/blob/master/examples/music.py
The code that I'm using.
I would recommend you try this video as it gives a better example that works:
https://www.youtube.com/watch?v=X1DEos_9dJo.
I usually get the 'Nonetype' error when someone tries to play something but the command still works perfectly fine. I usually ignore this error because all of the music commands I use on my bot work perfectly fine with it.
The video also has a github repo so you can test to see if it works.

Alexa skill in java not waiting for response

I'm trying the WiseGuy sample app in Java and can get Alexa to say "knock knock" but then the light turns off and that's it, I don't get to say "who's there".
Same issue with my own skill, even though I'm using newAskResponse(). Is there anything else I need to do?
Thanks!
Etienne
Fixed it by using the jar file produced by Maven instead of directly using the source code. Not sure why that makes a difference.
When you face issues like this, don't forget, you can use the skill configuration "Test" tab, to test the skill, to make sure it's not an interpretation problem (which can happen often).
Also, if doing that still gives you a response that you are not expecting you can copy that intent request:
And that past it on your lambda function event Test, there you will be able to see a more detail "debug" and if you are still not sure, make sure you do a few prints to at least pin point where the issue is:)

Read Gnome Shell Notifications

I need to read the gnome-shell notifications to send an e-mail whenever event X happens (like a torrent was successfully downloaded). Is there a file or a callback that I can read/set in C code?
A very easy option would be to call the notify-send tool from your code. It is used like this:
notify-send [OPTION...] <SUMMARY> [BODY] - create a notification
For more information, see the accompanying man-page.
Edit: I first read this question wrong and thought you wanted to send notifications. For reacting to notifications, I would suggest writing a gnome-shell extension. There is already an example extension that shows how to react to all notifications.
I am not aware of any callbacks for your own code, sorry. But you could probably roll your own notification callback via DBUS. See the DBUS homepage for more details. In short, your shell extension could generate an appropriate DBUS message, to which your program then could react.
Sorry for my reading error :)

Resources