M
M
Mind20772021-03-04 17:53:56
Python
Mind2077, 2021-03-04 17:53:56

You need to specify the ctx argument in on_message in discord.py, but it gives an error. How to solve it?

@bot.event
async def on_message(message,ctx):
    rolemute = discord.utils.get(ctx.guild.roles, name=('Muted'))
    if rolemute in ctx.author.roles:
        await ctx.channel.purge(limit=1)
        await bot.process_commands(message)


the code is needed to remove messages from people with the muted role, but discord.py does not accept 2 arguments in on_message. Is it possible to somehow do without ctx?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
E
Evgeniy _, 2021-03-04
@GeneD88

Head-on solution: message must contain author.id , based on this, you can find out its role and delete it.

S
Stalker_RED, 2017-12-09
@Stalker_RED

The script has been obfuscated .
You can use some kind of deobfuscation service like jsbeautifier.org (there are many similar ones). But he will not completely restore the source code, do not hope.

P
profesor08, 2017-12-09
@profesor08

Well, you have an obfuscated miner code. If you look closely, you will see simple operations. If you follow it, you can see how it all translates into quite understandable operations and calls. Functions are accessed through window, like so window["Math"]["cos"](1). From that moment on, it should have dawned on you and all questions should have disappeared as a matter of course. If this did not happen, then alas, programming is not yours at the moment.

I
ilya777grin23, 2018-04-06
@ilya777grin23

Isn't _0x5d8e.map(e => e.toString()) a solution?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question