message

How to get the second last message from a channel discord py

How to get the second last message from a channel discord py Question: i’m trying to make a command that edit the second last message (after the !command message) embed in a channel, but i cant find a way to get the second last message; i get this error discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: …

Total answers: 1

Trying to have my discord bot add roles from a reaction to a message

Trying to have my discord bot add roles from a reaction to a message Question: I’m having an issue where my bot wont give the respected role when a user reacts to the message correctly @client.event async def on_raw_reaction_add(payload): # Get the user who added the reaction guild = client.get_guild(payload.guild_id) reacting_user = guild.get_member(payload.user_id) # Get …

Total answers: 1

Remove messages before the response is rendered

Remove messages before the response is rendered Question: I’ve got a page which contains 2 forms & allows updating of the model attached to each. I’ve also got the messages framework integrated which for the most part is perfect. But after posting to this page you get two messages of success and I’d like to …

Total answers: 2

Python PyQt5: How to show an error message with PyQt5

Python PyQt5: How to show an error message with PyQt5 Question: In normal Python (3.x) we always use showerror() from the tkinter module to display an error message but what should I do in PyQt5 to display exactly the same message type as well? Asked By: Ramón Wilhelm || Source Answers: The following should work: …

Total answers: 6

Delete all django.contrib.messages

Delete all django.contrib.messages Question: I recently realized that a module in our Django web app was using django.contrib.messages. However, the template’s context processor did not have the django.contrib.messages.context_processors.messages processor added. I’m worried that when I push this to production, users will see all their old messages for all pages that had generated them. Is there …

Total answers: 3

How do I raise the same Exception with a custom message in Python?

How do I raise the same Exception with a custom message in Python? Question: I have this try block in my code: try: do_something_that_might_raise_an_exception() except ValueError as err: errmsg = ‘My custom error message.’ raise ValueError(errmsg) Strictly speaking, I am actually raising another ValueError, not the ValueError thrown by do_something…(), which is referred to as …

Total answers: 17