discord

Discord.js error = “message is not defined”

℡╲_俬逩灬. 提交于 2020-04-17 20:34:49
问题 const Discord = require('discord.js'); exports.run = async (bot, message, args) => { let userInfMent = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0])) message.channel.send(userInfo(userInfMent)); } function userInfo(user) { const Discord = require('discord.js'); let userInfMent = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0])) var userCreated = userInfMent.createdAt.toString().split(' '); var lastMsg =

Discord.py get user object from id/tag

吃可爱长大的小学妹 提交于 2020-04-11 17:37:24
问题 So i'm trying to get a user object from an id or tag, however i am using a user account not a bot account so i cant use get_user_info() Is there any way to do this on an user account? 回答1: I you know the user id, I suggest using user = bot.get_user(user_id) instead (documentation here). 回答2: If you're using commands , you can use a converter @bot.command(pass_sontext=True) async def mycommand(ctx, user: discord.User): # user is a User object Other wise, you can use Client.get_all_members to

How to assign a user a role in a server from a direct message discord.py

℡╲_俬逩灬. 提交于 2020-03-28 07:06:33
问题 So I am trying to make a bot where if a user direct messages the bot, it will give them a role in a server that both the user and the bot are in. I tried to just add the role based on the role ID but that did not work. Here is an example of what I was thinking which could maybe help explain it a bit better. role = (role ID) member = message.author await client.add_roles(member, role) Now keep in mind this will be happening in a direct message, and not in a server where this would be much

How to assign a user a role in a server from a direct message discord.py

落爺英雄遲暮 提交于 2020-03-28 07:05:02
问题 So I am trying to make a bot where if a user direct messages the bot, it will give them a role in a server that both the user and the bot are in. I tried to just add the role based on the role ID but that did not work. Here is an example of what I was thinking which could maybe help explain it a bit better. role = (role ID) member = message.author await client.add_roles(member, role) Now keep in mind this will be happening in a direct message, and not in a server where this would be much

Discord.js Issue with “.addRole”

北城以北 提交于 2020-03-25 18:54:07
问题 So, I have been having issues setting up a bot that roles a user to a role that includes emoticons. Example: const guildMember = message.member; guildMember.addRole('<@&439191493169643521>'); I've also tried: // content.js const guildMember = message.member; guildMember.addRole(config.n); // config.json { "n": "🦊Fox" } and also I've tried it without config.json, and just put the raw rank name, but it always doesn't work. This is the Console: (node:15600) UnhandledPromiseRejectionWarning:

Get Discord Bot to read and update spreadsheet in JavaScript via Google Sheets API

这一生的挚爱 提交于 2020-03-25 16:07:16
问题 I have a Discord bot that I host on glitch.com whose aim is to store, read and update some basic stats for the users. Since this setup caused the variables to reset each time the project went to sleep, I successfully setup the Google Sheets API so that I could store the user's stats somewhere else permanently. However, I cannot for the love of God figure out how to actually make my JavaScript variables get their value from the spreadsheet. My initial code simply had a lot of variables that

How to use a discord.py bot that gives a user role when they join VC and remove it when they leave

 ̄綄美尐妖づ 提交于 2020-02-26 03:52:04
问题 I'm trying to make a discord bot that gives a user role when they join a voice channel and removes the role when they leave it. I know about on_voice_state_update and how to give a user a role but I don't know how to get what user joined the channel to give them the role. Right now my code is slightly modified version of the answer from How to use discord.py event handler on_voice_state_update to run only when a user joins a voice channel. @client.event async def on_voice_state_update(before,

Fetch more than 100 messages

倾然丶 夕夏残阳落幕 提交于 2020-02-24 12:57:31
问题 I'm trying to figure out a way to use loops to get old messages on discord using fetchMesasges() and before . I'd like to get more than the 100 limit using a loop but I cannot figure it out, and every post I can find only discuss how to use loops to DELETE more than the 100 limit, I just need to retrieve them. I'm new to coding and javascript in particular so I'm hoping someone can give me a nudge in the right direction. Here is the only way I could manage to retrieve messages that are

Fetch more than 100 messages

随声附和 提交于 2020-02-24 12:52:44
问题 I'm trying to figure out a way to use loops to get old messages on discord using fetchMesasges() and before . I'd like to get more than the 100 limit using a loop but I cannot figure it out, and every post I can find only discuss how to use loops to DELETE more than the 100 limit, I just need to retrieve them. I'm new to coding and javascript in particular so I'm hoping someone can give me a nudge in the right direction. Here is the only way I could manage to retrieve messages that are

Meta tags for URL with description and image (In Skype, Discord)

为君一笑 提交于 2020-02-13 05:45:37
问题 When somone send link in Skype or Discord, it can create image and description, like is shown on screenshots: I think its because of <meta> tags in HTML <head> . But in HTML can be hunderts of <meta> tags.. I found this page on GitHub, Link: https://gist.github.com/lancejpollard/1978404 And that's so many tags. Is there someone who know only tags, which is making these images and descriptions on Skype and Discord? I tried adding some meta tags, favicon, and title, but it not works, I don't