discord

Discord OAuth Code Usage

风流意气都作罢 提交于 2021-01-21 08:26:03
问题 I'm interested in interfacing with Discord using the Discord API. I would describe their documentation as "sparse," but maybe I'm just not looking in the right places. Most of my information comes from this page: https://discordapp.com/developers/docs/topics/oauth2 I've already set up my Discord guild and application (and even a bot, which may be unnecessary). My specific plan to is to allow users to give my site permission to add them to a private Discord guild/server. I have a hyperlink on

Custom Emoji's and Animated Emoji's not working [discord.py-rewrite]

不羁岁月 提交于 2021-01-20 11:34:20
问题 I recently built a simple command to test the format of custom emoji's and animated emoji's Here is what the command was @bot.command() async def say(ctx, *, text): await ctx.send("<:ono:521148278079881219> You said %s" % text) But the output message didn't send the custom emoji, instead it messaged :ono: You said hello(the text i messaged in chat) Any help will be appreciated. 回答1: You can use Client.get_emoji to get the Emoji object, then use that to build your string @bot.command() async

Custom Emoji's and Animated Emoji's not working [discord.py-rewrite]

大城市里の小女人 提交于 2021-01-20 11:34:06
问题 I recently built a simple command to test the format of custom emoji's and animated emoji's Here is what the command was @bot.command() async def say(ctx, *, text): await ctx.send("<:ono:521148278079881219> You said %s" % text) But the output message didn't send the custom emoji, instead it messaged :ono: You said hello(the text i messaged in chat) Any help will be appreciated. 回答1: You can use Client.get_emoji to get the Emoji object, then use that to build your string @bot.command() async

Custom Emoji's and Animated Emoji's not working [discord.py-rewrite]

点点圈 提交于 2021-01-20 11:33:55
问题 I recently built a simple command to test the format of custom emoji's and animated emoji's Here is what the command was @bot.command() async def say(ctx, *, text): await ctx.send("<:ono:521148278079881219> You said %s" % text) But the output message didn't send the custom emoji, instead it messaged :ono: You said hello(the text i messaged in chat) Any help will be appreciated. 回答1: You can use Client.get_emoji to get the Emoji object, then use that to build your string @bot.command() async

Get a Discord Role by Id

牧云@^-^@ 提交于 2021-01-20 04:47:10
问题 I'm making a Discord bot but just ran into a problem. I want to modify a role. A specific role. I know how to do that with edit_role , but I need to get the Role object to edit it. Now, that's the problem. How do I get a Role object by the role's id ? Or can I use the id in the Role argument ? 回答1: You can use discord.utils.get to loop through Guild.roles and get the one you're looking for: from discord.utils import get role_id = 123 role = get(guild.roles, id=role_id) 回答2: You can simply use

Guild members are not populated anymore, cannot GetUserAsync as it only returns the bot and no one else

此生再无相见时 提交于 2021-01-13 09:18:48
问题 For some reason I cannot get any members anymore from the guild the bot is in. To make sure I have the users, I construct it with DiscordSocketConfig config = new DiscordSocketConfig { AlwaysDownloadUsers = true }; client = new DiscordSocketClient(config); The event I respond to is long after it has connected. It will pick up messages from the channels themselves in the guild the bot is in, so it's connected, working, and can see all of the members. I go through all the members and I'm trying

Guild members are not populated anymore, cannot GetUserAsync as it only returns the bot and no one else

允我心安 提交于 2021-01-13 09:16:15
问题 For some reason I cannot get any members anymore from the guild the bot is in. To make sure I have the users, I construct it with DiscordSocketConfig config = new DiscordSocketConfig { AlwaysDownloadUsers = true }; client = new DiscordSocketClient(config); The event I respond to is long after it has connected. It will pick up messages from the channels themselves in the guild the bot is in, so it's connected, working, and can see all of the members. I go through all the members and I'm trying

Sending a message to a specific user specified in the message, discord.py

橙三吉。 提交于 2021-01-07 04:26:31
问题 In my discord.py code I am trying to set up a simple send message to a user that the message author has specified. if message.content.startswith('!hello'): print("Hello DIRECT MESSAGE") msg = "Why hello there" print (message.author) await client.send_message(message.author, msg) if message.content.startswith('!poke'): print("Poke DIRECT MESSAGE") a = message.content[6:] print(a) msg = "Hi there" await client.send_message(a, msg) The !hello command works fine, but I do not know how to get the

Discord.js Bot Command that says a sentence from a random list of premade ones

╄→尐↘猪︶ㄣ 提交于 2021-01-07 02:57:00
问题 So basically, I'm trying to make a certain command for my bot, and I was going to see if any of you could help write something up. I want to make a command where a user types the command and then the bot will randomly choose from a list of prewritten sentences. I'm trying to make a fact command where when you do !fact it responds with a random fact. Note: This would be for my command handler. Thanks if any of you can help! 回答1: var facts = ["Your facts", "...", "..."]; var fact = Math.floor

Discord.js Bot Command that says a sentence from a random list of premade ones

会有一股神秘感。 提交于 2021-01-07 02:55:40
问题 So basically, I'm trying to make a certain command for my bot, and I was going to see if any of you could help write something up. I want to make a command where a user types the command and then the bot will randomly choose from a list of prewritten sentences. I'm trying to make a fact command where when you do !fact it responds with a random fact. Note: This would be for my command handler. Thanks if any of you can help! 回答1: var facts = ["Your facts", "...", "..."]; var fact = Math.floor