I'm using the PushSharp library
I'm handling this event right now: DeviceSubscriptionChanged
My question is if the notification has been sent to the new Token and the only thing I should do is to update the new token replacing the old one.
Or, on the other hand, I also should resend the notification to the new Token...
Thanks!
Ok, here someone gave me the answer
https://github.com/Redth/PushSharp/issues/468
The answer is that the only thing I should do when the event is trigger is just to replace the old token for the new one.
Hope this will help somebody!
Related
I'm trying to make this command notify my admins of a bot test and need it to mention the user who called the command. How would I go about that? I don't fully understand how to get that information with slash commands.
#client.slash_command(name= "test", description="(For Deputies or Leader only) Checks the operational state of the client.", guild_ids=[806043206030589952])
#has_any_role(leader_id, deputy_id)
async def test(interaction:Interaction):
bot_log = channel_up(940125176723554394)
await bot_log.send(f'<#&806045254834847776>,{} has started diagnostics for the bot. Please ignore any possible disturbances for the next minute or so.')
Thanks in advance for the advice, it's the first discord bot I've ever created.
EDIT:
In documentation, I found the solution. I have to use interaction.user.mention to get it to mention the user who sent the command. Or at least in theory, I'm dealing with a different issue now. Hopefully this helps people who also were as confused as me out.
You can use the interaction.user.name function with an # at the beginning.
The code should look something like this:
await interaction.response.send_message("#"+str(interaction.user.name))
I need help reacting to the most recent message. This can be in a specified channel or just in the server. The main thing I need help with is getting the message id or info about the most recent message, the reacting part I can do.
Please let me know if there is a solution, as everything I have looked up hasnt produced any results.
Thanks!
There are quite a few methods to get the last message in a channel. Assuming you already have a specific channel in which you want to react. Use
last_message = channel.last_message #channel must be a discord.Channel
The docs specify that this could sometimes get the wrong message, hence we use
messages = await channel.history(limit=1).flatten()[0]
References:
last_message
history
Tip:
Try searching for the relevant class in the docs instead of googling
Can someone please explain how to properly remove code from your discord bot?
So, recently, I started coding a discord bot. So far the only command I've made was, when I say "ping", it replies with "pong."
BUT. It would mention you with the "#" symbol. I didn't like that so I removed the function and instead made it just say "pong" without mentioning you. But, when I tested it, it would mention me and say pong. AND it would also just send a message that said pong. So I removed the whole code. NOPE it still kept replying to my message so I even removed the bot login method but it still kept replying with pong.
If there is something I need to fix in my code, then this is the code (and yes I made a variable for "bot"):
bot.on('message', message =>{
let args = message.content.substring(PREFIX.length).split(" ");
switch(args[0]){
case 'ping':
message.reply('pong!')
break;
}
})
It's because you're using message.reply(). This will always mention the original author. Use message.channel.send() instead.
Okay. So like, I'm actually dumb. All I had to do was restart visual studio
I ran into another snag while going through the ThinksterIO Learn to Build Real Time Webapps tutorial around the 90% mark where one is shown how to add and delete comments:
https://thinkster.io/angulartutorial/learn-to-build-realtime-webapps/#adding-comments-functionality-to-the-post-service-9
Every time I click the Post Comment button absolutely nothing happen and I simply can't figure it out. I am expecting some kind of error to show up but nil. It's as if the button is not hooked up to the function. I was so frustrated that I eventually just copy and pasted the code from the tutorial to make sure I had it down right. Even after doing that it still didn't work.
I've created a Plunker with this app running over here http://embed.plnkr.co/OhzDTU/preview
You can sign in with the email user#user.com and 1234 password. You will then be able to try to comment on posts. Any ideas on what is going wrong here?
UPDATE
I took away the user user#user.com and 1234 password since problem is now fixed.
Your add comment button is in showpost.html, which is rendered by PostViewCtrl. However, your addComment method is attached to the scope of PostsCtrl (it doesn't exist when you try to click it). The simplest answer here is just to move addComment() over to the other controller.
Regarding the lack of error messages, I don't think that you can get an error for this. I had a look at the docs for $log and tried to decide if you could add some debugging output, but it looks like it's already on (i.e. the lack of a method seems to fail silently).
About your only option here is to try something like {{addComment|json}} in the view to see if it exists, but you'd first have to suspect that it didn't.
The +1 API documentation is here: http://code.google.com/apis/+1button/#jsapi
There is no mention of how to determine whether the viewing user has already clicked the button or not. This would be a very useful function because it would allow me to encourage people who haven't +1'd a page to do so without putting users who have already +1'd the page through a needless and possibly confusing step.
Has anyone found a way to do this? Thanks
There is callback attribute, which allows you to add custom callback function, which can react to +1 or -1. See http://www.odditysoftware.com/blog/trap-and-track-google-plus-button-click-events_45.html
But your question is old, maybe it wasn't present yet.