齿轮命令消息发送两次

时间:2020-07-24 08:35:15

标签: python discord discord.py

我昨天切换到齿轮,所以我的代码看起来更简洁。从那时起,所有命令都中断了。如果您发送t!profile,它将发送两次消息。我发现问题出在我创建的过滤器上。 enter image description here

        if getImmunityValue == 0:
            for word in getWord:
                if getMutedValue == 0:
                    message.content = message.content.lower()
                    if message.content.count(''.join(word)) > 0:
                        id = message.author.id
                        curs.execute('SELECT channelID FROM getchannel')
                        getChannelID = curs.fetchone()[0]

                        channel = self.client.get_channel(getChannelID)

                        curs.execute('SELECT strike FROM user WHERE userID = (%s)', (id,))
                        getstrike = curs.fetchone()[0]

                        curs.execute(f'UPDATE user SET strike = {getstrike + 1} WHERE userID = {id}')
                        db.commit()

                        await message.delete()
                        await message.channel.send(f'{message.author.mention} Bitte benutzte kein Schimpfwoerter. Falls du weiter machen solltest, wirst du gebannt oder gemutet!')

                        Embed = discord.Embed(
                            title=f'{getstrike}x strike(s) from {message.author}',
                            color=discord.Colour.red(),
                            timestamp=self.datetime.utcnow()
                        )

                        Embed.add_field(name='Blacklist Wort:', value=message.content, inline=False)
                        Embed.add_field(name='Channel-ID:', value=message.channel.id, inline=False)
                        Embed.add_field(name='Channel:', value=message.channel, inline=False)

                        await channel.send(embed=Embed)

        await self.client.process_commands(message)

1 个答案:

答案 0 :(得分:0)

问题是await self.client.process_commands(message)我不知道为什么,但是可以解决。