discord

Discord.js Music Bot in a command handler

梦想与她 提交于 2019-12-11 17:16:22
问题 I want to make a music bot in my command handler, but I ran into some problems. This is the command handler I use: delete require.cache[require.resolve(`./commands/${command}.js`)]; let commandFile = require(`./commands/${command}.js`); commandFile.run(client, message, args); And in my play.js file I have a queue: var servers = {}; I don't know how to make it so that I can skip a song (using the skip command - skip.js) in the queue. Code for skipping: if (server.dispatcher) server.dispatcher

Find all User's UserID in a server

旧城冷巷雨未停 提交于 2019-12-11 17:13:26
问题 How would I find and store all of the users UserID's in a discord server? @client.event async def on_message(message): if message.content.startswith("##kickrandom"): await client.send_message(message.channel, "Kicking a random user in 30 seconds...") 回答1: Each user only has 1 ID, so you can get a full list of members on the server and grab the ID of each ids = [] for m in server.members: ids.append(m.id) Python has a tool to do this quickly called list compression. ids = [m.id for m in server

How can I count the number of messages in one channel of each user?

人盡茶涼 提交于 2019-12-11 16:04:34
问题 I want to code a discord bot with the discord.js ... But in the documentation, I don't found a function to count the number of messages in a channel of each user... Is there a function to use the searchbar with filters like an user? 回答1: The search is not ( yet ) avaible for Bots. You could Channel#fetchMessages but this would be very Api intensive. Best way would be to get a database and increment it when the user sends a message, but that will only count messages when the bot is running. 来源

C# Discord Bot - Upload Local Image

一曲冷凌霜 提交于 2019-12-11 15:57:51
问题 I created this bot using C# to help my alliance out in a phone game. We are using discord to communicate. One of the functions of my bot is to set up "Raid Lane" so people can claim the path they are going to take. Our alliance has an image set spread out across our discord, I want to have the relevant image to each raid be posted when the bot sets up the raid lanes for that difficulty. Currently i have : var embed = new EmbedBuilder(); embed.WithTitle("Ultimus Raid - Level 40"); embed

Discord.js - Guild ID is undefined even though definition is there

僤鯓⒐⒋嵵緔 提交于 2019-12-11 15:21:00
问题 Making a discord bot. Everything works fine, except the one command of -!prefix . -! being the prefix, and the command taking the args and changing the prefix of the server. Before I go into detail about this while thing, here's the bot's code, maybe I simply did something wrong in the consts: Hastebin Link The error here is in line 52, according to the console: Console Log I'm confused as to what to do with this being "undefined." I've tried using the message.guild.id property as the

I Installed a Module Called Discord and When Using “import discord” I Get the Error: “ModuleNotFoundError: No module named 'discord'”

☆樱花仙子☆ 提交于 2019-12-11 15:19:22
问题 The module 'discord' I installed in the command prompt which I ran as administrator can't be found. It's located in my site-packages directory along with some other modules such as setuptools which when I import, are imported successfully without error. However, discord which is in the same directory doesn't. In the environment variables I have Path which I've specified to site-packages but I still receive the error that discord cannot be found. 回答1: That error is common on Python version 3.7

YT Search on Discord Bot

好久不见. 提交于 2019-12-11 15:15:49
问题 i would like to know how to make my bot play music based on YouTube search rather than having to copy in a URL. Here's my code for playing music right now, @client.command(pass_context=True) async def play(ctx, url): server = ctx.message.server await client.say ('Music now playing...') voice_client = client.voice_client_in(server) player = await voice_client.create_ytdl_player(url, after=lambda: check_queue(server.id)) players[server.id] = player player.start() What is it that I need to add

Getting Bot Variable Into Different Commando Files

蹲街弑〆低调 提交于 2019-12-11 15:14:30
问题 I use commando for my discord.js bot, and it's linked to the client. I want to be able to use the bot variable in a different file, mainly to help check if the bot has the correct permissions. My Bot variable: const bot = new commando.Client({ commandPrefix: '!', owner: config.ownerID, unknownCommandResponse: false }); This is currently in my index.js file, but is there a way for me to be able to use it in a different command file? 回答1: You could do index.js const bot = new commando.Client({

Basic one-message dice roller?

淺唱寂寞╮ 提交于 2019-12-11 15:11:35
问题 This is the same discord bot I've asked about in the last question I posted here, and I want to add a simple dice rolling function that doesn't take up multiple messages so I don't spam the server I'm in. So far, I have the barebones code for the dice roller itself working here: if (message.content.toLowerCase().includes("rei!d100")) { var response = [Math.floor(Math.random() * ((100 - 1) + 1) + 1)]; message.channel.send(response).then().catch(console.error); } And as of right now it just

How to add reaction to an embed message JDA

风流意气都作罢 提交于 2019-12-11 15:09:56
问题 I'm trying to send and embed message when I do the command ~verify and then it sends an embed message and I cant find how to add to there a reaction. I did already the embed message and sent it but can add the reaction import Main.Bot; import net.dv8tion.jda.core.EmbedBuilder; import net.dv8tion.jda.core.MessageBuilder; import net.dv8tion.jda.core.entities.Message; import net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent; import net.dv8tion.jda.core.hooks.ListenerAdapter;