discord

Discord Add Guild Member 401 Error Despite Apparently Valid Access Token

无人久伴 提交于 2019-12-18 06:58:18
问题 I am new to Discord's API, and I am working a project which needs to be able to add a guild member programmatically. I've learned how to get an authorization code (with identify and guilds.join scopes), redeem it for an access token, and get a user's ID. The last step is to use the access code and user ID to add the guild. This command is detailed here: https://discordapp.com/developers/docs/resources/guild#add-guild-member It seems I need to send a PUT request to this URL: https://discordapp

discord.js bot replies to itself

こ雲淡風輕ζ 提交于 2019-12-18 05:47:06
问题 I am currently coding my first discord bot, it can already play YouTube music. if (message.content.includes("Good Job") || message.content.includes("good job")) { message.channel.sendMessage("Good Job everyone :smirk:"); } As you see, if someone types "good job" (this is just an example) then the bot will reply with "good job everyone :smirk:), but then the spam will begin: the bot reads his own message and replies to it. How can I prevent the bot from answering itself? 回答1: Use this in the

Send a message with Discord.js

本小妞迷上赌 提交于 2019-12-18 04:34:15
问题 So. I am trying to make a discord bot, but i can't quite understand Discord.js. My code looks like this: client.on("message", function(message) { if(message.content === "ping") { client.message.send(author, "pong"); } }); And the problem is that I can't quite understand how to send a message. Can anybody help me ? 回答1: You have an error in your .send() line. The current code that you have is used in an earlier version of the discord.js library, and the send function has been changed. To send

Discord PIP Install Error

匆匆过客 提交于 2019-12-14 03:27:52
问题 I tried to install discord libraries in PIP but received an error, this is the error is received in screenshot form: https://gyazo.com/7fb01731b10773ecfba0ae541a4a69ca I do not know why this has happened, could someone explain it to me? 回答1: Upgrade pip to the latest version. 来源: https://stackoverflow.com/questions/46133128/discord-pip-install-error

The channel provided must be a voice channel. error with move_member

孤街浪徒 提交于 2019-12-14 02:24:03
问题 import discord from discord.ext import commands from discord.ext.commands import Bot import asyncio import time bot = commands.Bot(command_prefix='$') @bot.event async def on_ready(): print ("Ready") @bot.command(pass_context=True) async def Move(ctx): #channel to move to '414543063575429131' #user to move '192361974053470208' await bot.move_member('192361974053470208', '414543063575429131') print("done") bot.run("token_here") This is my code but I when I try to move the user it gives me the

Create Channel Switch Logger

大憨熊 提交于 2019-12-14 00:07:42
问题 I'm trying to create a channel switch logger which allows me to specify a channel where the messages get posted. So, for example, I create a TextChannel called "Channel Switches". When now a user changes voice channel, it should appear a message in this Channel. (eg. <USER> left channel <CHANNEL> and joined <CHANNEL>. ) MY PROBLEM IS: I get no errors and the Bot is not responding... Here my first try: var Discord = require('discord.js'); var logger = require("winston"); var auth = require(".

If the user reacts with 😃, I want the bot to edit the message

自作多情 提交于 2019-12-13 22:38:09
问题 Something like this. @client.event async def on_reaction_add(reaction, user): a = await client.say("React to see help") if reaction.emoji == "😃": await client.edit_message(a, "Moderator commands") Here's an example: https://cdn.discordapp.com/attachments/562005351353024525/569931890577113098/unknown.png But I want the bot to edit the first message. Can someone help? 回答1: You need to send a message when the bot comes online, then monitor that message for new reactions. The easiest way to do

How to create a text channel

旧巷老猫 提交于 2019-12-13 18:18:37
问题 Recently I have been making a discord bot, and I wanted to make a channel once the players have entered the command >report [Tag] [Reason] . Here are the two methods I have tried (one from a previous StackOverflow question that did not work for me): function makeChannel(message){ var server = message.guild; var name = message.author.username; server.createChannel(name, "text"); } Then I tried my own version to see if I could do it: var name = message.author.username; let reportchannel =

How to get snekfetch results into an object?

我怕爱的太早我们不能终老 提交于 2019-12-13 18:14:40
问题 I'm writing a discord.js bot and trying to call a weather API using Node.js / snekfetch. The issue is I can't figure out how to just put the data returned from the API into a javascript object. I want to do something like this: let [country, ...city] = args; let url = `http://api.openweathermap.org/data/2.5/forecast?q=${city},${country}&units=metric&APPID=${config.weatherID};`; var weatherObject; snekfetch.get(url).then(r => weatherObject = r.body);` but obviously this doesn't work so what am

Can not use startsWith Discord.js question

☆樱花仙子☆ 提交于 2019-12-13 10:28:41
问题 this is my role command. I'm trying to use startsWith to give roles: if the arg's first letters are the same as the role, it should be assigned to the user. exports.run = async function (msg,args) { if(!msg.member.hasPermission('MANAGE_ROLES')) return; const member = msg.mentions.members.first(); const name = msg.mentions.users.size ? args.replace(/ +/, ' ').split(' ')[1] : args; const role = msg.guild.roles.find(r => r.name.toLowerCase().startsWith(name.toLowerCase())); if (name && !role