discord

How do I make my bot delete a message when it contains a certain word?

时光毁灭记忆、已成空白 提交于 2020-02-08 10:36:47
问题 Okay so I'm trying to make a filter for my bot, but one that isn't too complicated. I've got this: @bot.event async def on_message(ctx,message): if 'fuck' in Message.content.lower: Message.delete() But it gives the error: Ignoring exception in on_message Traceback (most recent call last): File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\client.py", line 270, in _run_event await coro(*args, **kwargs) TypeError: on_message() missing 1 required positional

Discord.Net - Sending command and then getting response

霸气de小男生 提交于 2020-01-30 12:01:10
问题 I have been struggling to find an answer to this question. I would like to get the response to a command and use that as a parameter - argument. Example: User: /say Bot: What would you like me to say? User: Hello, how is your day going? Bot: Hello, how is your day going? Any help is greatly appreciated! 回答1: You can achieve this with Discord.Addons.Interactive Example code 来源: https://stackoverflow.com/questions/50054535/discord-net-sending-command-and-then-getting-response

How to get the username and Discord tag of the owner of server - Python

自古美人都是妖i 提交于 2020-01-30 11:30:28
问题 I'm looking for a method in the discord.py library to return the owner of the server the bot has been deployed in. Right now I just have it hard coded (i.e. if message.content == '!owner': await message.channel.send('ownername#1234') ), but when the owner changes their name I have to change it, and it seems like a hassle for nothing. I've looked into the permissions system of discord.py but it doesn't seem to have something that does this. Is there anything that does this? 回答1: You're looking

How to get the username and Discord tag of the owner of server - Python

泄露秘密 提交于 2020-01-30 11:30:17
问题 I'm looking for a method in the discord.py library to return the owner of the server the bot has been deployed in. Right now I just have it hard coded (i.e. if message.content == '!owner': await message.channel.send('ownername#1234') ), but when the owner changes their name I have to change it, and it seems like a hassle for nothing. I've looked into the permissions system of discord.py but it doesn't seem to have something that does this. Is there anything that does this? 回答1: You're looking

Finding author of a message

≡放荡痞女 提交于 2020-01-30 07:57:25
问题 If someone writes "?name (arg)" I want my bot to say the author of the message + ", your name is" + arg. I can't find of the author of the message though. @client.command() async def name(their_name): await client.say("{0}, your name is {1}.".format("""author of the message goes here""", their_name)) 回答1: To get the name of the author of the message, you will need to use context @client.command(pass_context=True) async def name(ctx): username = ctx.message.author.name ... 回答2: You can also

how to connect a discord bot through proxy

我们两清 提交于 2020-01-25 04:39:07
问题 I am trying to run a discord bot using discord.py and through a proxy. The discordpy doc on this is pretty scarce on the subject and not up to date with aiohttp implementation. discordpy doc basically says to use a ProxyConnector and pass it as an argument when the client is created. But in aiohttp, this way is deprecated and client.ClientSession().get is recommended instead. Problem is, client.ClientSession().get asks me to provide a URL. I also tried with ProxyConnector anyway, but it doesn

Discord.js - Getting users last activity?

一世执手 提交于 2020-01-24 06:44:06
问题 I'm trying to find out if its possible to get the time/information of users last activity retrospectively using discord.js Say I have something like client.guilds.find('id', 'SERVER ID').fetchMembers().then(members => { const role = members.roles.find('name', 'Newbies') role.members.forEach(member => { console.log(member.user.lastMessage) // null }) }) Unless the member has posted, since the client is listening, the lastMessage is always null. Is there a way to find the last activity? or a

How to remove Author Tag from being visible in Discord's previews?

谁说胖子不能爱 提交于 2020-01-24 01:37:10
问题 When sharing a post to Discord, the preview Discord generates shows the author name and URL. We removed all information about the author but it didn't stop the author tag from showing. 回答1: add_filter( 'oembed_response_data', 'disable_embeds_filter_oembed_response_data_' ); function disable_embeds_filter_oembed_response_data_( $data ) { unset($data['author_url']); unset($data['author_name']); return $data; } 回答2: @hrak has the right idea but his answer lacks context for those of us not used

Discord.js setGame() not working anymore

。_饼干妹妹 提交于 2020-01-21 12:43:16
问题 I have been coding my Discord bot using Discord.JS for about 2 months now and I've just recently noticed that my bot isn't saying that it's playing what I'm telling it. When I first coded the bot up until recently it worked just fine. Now the 3 discord bots I have aren't showing their games. This is the code I'm using: const Discord = require("discord.js"); const bot = new Discord.Client(); bot.on("ready", () => { console.log("Ready"); bot.user.setGame("Type !help"); } 回答1: .setGame() is

Discord.js setGame() not working anymore

不想你离开。 提交于 2020-01-21 12:43:10
问题 I have been coding my Discord bot using Discord.JS for about 2 months now and I've just recently noticed that my bot isn't saying that it's playing what I'm telling it. When I first coded the bot up until recently it worked just fine. Now the 3 discord bots I have aren't showing their games. This is the code I'm using: const Discord = require("discord.js"); const bot = new Discord.Client(); bot.on("ready", () => { console.log("Ready"); bot.user.setGame("Type !help"); } 回答1: .setGame() is