discord

Error on music discord bot in python 'NoneType' object has no attribute 'create_ytdl_player'

孤者浪人 提交于 2021-01-29 14:21:46
问题 When ever i run this code: @client.command(pass_context=True) async def ranjaplay(ctx, url): server = ctx.message.server voice_client = client.voice_client_in(server) player = await voice_client.create_ytdl_player(url) players[server.id] = player player.start() it returns with this error: Traceback (most recent call last): File "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\lib\site- packages\discord\ext\commands\bot.py", line 846, in process_commands yield from command.invoke(ctx)

Value tallying code dysfunctions when put into discord command

删除回忆录丶 提交于 2021-01-29 13:51:01
问题 I just coded my bot and basically it sums every user's daily guild XP from the last seven days and prints it in a list into a google sheet. There is one problem and it is that the guild XP values in the list are wrong when manually adding up, which is the guild XP from all seven days from the API JSON. The names it prints are right, but the values are wrong, and I can't tell exactly how they are. This only happens when the code below is run in a discord command, but the code functions

Discord client object is undefined after being exported

六眼飞鱼酱① 提交于 2021-01-29 13:44:48
问题 I've recently run into a problem. For the past several weeks I have been working on some discord bots I have made and am having trouble with exporting the client object. I've been trying to export it to other files so I can hook event listeners in other files using the same object. Below's what I attempted doing. main.js const client = new Discord.Client(); //Defining the client exports.squidly = client; //Attempting to export the client test.js const client = require('../squidly').squidly;

How to send a message and collect reactions from it in Discord.py

痴心易碎 提交于 2021-01-29 12:16:50
问题 If a bot was to send a message vote_msg = await ctx.channel.send('Vote ' + '@' + str(member) + ' out of the server? **' + str(out) + '/' + str(of) + '**') await vote_msg.add_reaction('✅') await vote_msg.add_reaction('❎') How could I get the bot to add up the reactions after 30 seconds? 回答1: Use message.reactions : Documentation vote_msg = await ctx.channel.send('Vote ' + '@' + str(member) + ' out of the server? **' + str(out) + '/' + str(of) + '**') await vote_msg.add_reaction('✅') await vote

Discord.js: message.guild.channels.forEach is not a function

落花浮王杯 提交于 2021-01-29 10:58:40
问题 I'm creating a Discord Bot using Discord.js I'm creating a mute command but when I want to disable speaking permission for the Mute role for each channel, I get this error: TypeError: message.guild.channels.forEach is not a function I have V12. And I looked at some other options but I couldn't find any working options. if(!toMute) return message.reply('It looks like you didnt specify the user!'); if(toMute.hasPermission('MANAGE_MESSAGES')) return message.reply("can't mute them"); let muterole

Discord bot send birthday message

余生长醉 提交于 2021-01-29 10:52:42
问题 I have made a Discord bot and I want it to be able to check the current date, and if current date is any of the users birthday, then it'll tag them and say happy birthday. I have tried using Node.js' Date, like if(Date === "this or that") but that didn't seem to work. So what I need help with is: Checking the current date (like run a check each day or something) send a message at that current date I'll probably just hardcode all the birthdays in since we're not that many (I know that's not

Creating a role, then giving the role to a member doesn't work, is there a better way to handle this? Discord.js

旧巷老猫 提交于 2021-01-29 10:47:38
问题 I want to create a role based off a message, then once that role is created, I want to give it to those that are mentioned in the same message. The role gets created perfectly fine, but the correct role isn't give to the user. I've tried going by the name, but that leads to the role not being found, so I'm trying to get the role based off the position that it is in, but when I need to give the role out, it doesn't seem to be in that correct position var nameOC = getClanName(message.content);

No Command responses using Discord.py Rewrite [duplicate]

不想你离开。 提交于 2021-01-29 10:20:20
问题 This question already has an answer here : Why does on_message stop commands from working? (1 answer) Closed 12 months ago . I have created a discord bot using the code below but when I type .8ball or .ping in the server, I get no response, nor do I get an error message of any kind. However, I do get the expected response of "Hi" when I type "hello" so I know it's connected. It's baffling me as I've checked the syntax 100 times and can't see any errors. import discord import random from

Cannot read property 'fetchBans' of undefined

随声附和 提交于 2021-01-29 10:10:36
问题 I'm trying out a new command, which is the unban command. However, if I run the code below I keep getting Cannot read property 'fetchBans' of undefined . I'm currently using v12.16.3. if(!message.member.hasPermission(["BAN_MEMBERS", "ADMINISTRATOR"])) return message.channel.send("You dont have permission to perform this command!") if(isNaN(args[0])) return message.channel.send("You need to provide an ID.") let bannedMember = await client.guild.fetchBans(args[0]) if(!bannedMember) return

Changing color roles discord

萝らか妹 提交于 2021-01-29 09:42:53
问题 First, I would like to point out that I am a beginner with python. I am trying to write a command that allows the user to change the color of his role via the bot. However, I have encountered many problems that I can not find an answer to. The first problem was that I could not get access to the role of the user calling the command. I decided, however, to skip it and go straight to a specific role. So i made this code: @client.command(pass_context=1) async def changecolor(ctx, NewColor):