discord

`TypeError: member.hasPermission() is not a function` when checking permissions in discord.js

£可爱£侵袭症+ 提交于 2021-01-28 19:48:50
问题 I am trying to make a has-permission command for my Discord bot, which takes two arguments: the user to check, and the permission to check for. You can see the code in the bot's GitHub repository (the config.json file is hidden due to it containing private information about my bot application). Discord Screenshot: The bot just replies there was an error trying to execute that command! . Console Screenshot: The console just says TypeError: member.hasPermission is not a function . Is there any

(discord.py) How do I get my bot to read DM's that are sent to it and either print them or send them to a specific channel

和自甴很熟 提交于 2021-01-28 19:28:28
问题 So I recently created a discord bot with various meme commands and moderating commands. I am relatively new to python but I understand the gist of it. I have already created a command that lets me(only me) DM a user through the bot. I now want to try and make the bot be able to read the messages that are sent back to it and send them to me, whether its printed in shell or sent to a specific channel/me I don't care, I just want to be able to see what is sent to it. I did some reading around

Delete all channels in a specific category

点点圈 提交于 2021-01-28 13:39:58
问题 How to delete all channels in a specific category in Discord.JS? I tried that oldMember.guild.channels.cache.get(client.tr["Settings"].MainChannelID).parent.channels.cache.forEach(c => { if(c.members.size != 0){ c.delete(); } }) 回答1: You can get all the channels that belong to a category using CategoryChannel.children const category = await oldMember.guild.channels.cache.get(CATEGORY_ID); // You can use `find` instead of `get` to fetch the category using a name: `find(cat => cat.name ===

Cooldown mapping | Discord.py

南楼画角 提交于 2021-01-28 12:52:29
问题 I am using on_message to scan the code for specific keywords so that the bot can respond accordingly, and no, I cannot use commands to achieve this. I want to prevent people from spamming these keywords by turning on a cooldown so the bot will wait before checking again What the documentation says: class SomeCog(commands.Cog): def __init__(self): self._cd = commands.CooldownMapping.from_cooldown(1.0, 60.0, commands.BucketType.user) async def cog_check(self, ctx): bucket = self._cd.get_bucket

Cooldown mapping | Discord.py

拜拜、爱过 提交于 2021-01-28 12:43:01
问题 I am using on_message to scan the code for specific keywords so that the bot can respond accordingly, and no, I cannot use commands to achieve this. I want to prevent people from spamming these keywords by turning on a cooldown so the bot will wait before checking again What the documentation says: class SomeCog(commands.Cog): def __init__(self): self._cd = commands.CooldownMapping.from_cooldown(1.0, 60.0, commands.BucketType.user) async def cog_check(self, ctx): bucket = self._cd.get_bucket

Discordpy Tasks not working as expected. No returning

こ雲淡風輕ζ 提交于 2021-01-28 12:30:28
问题 @tasks.loop(seconds = 5.0) async def remind420(self): print("YES") print(datetime.now().strftime("%H:%M")) if datetime.now().strftime("%H:%M") == "16:55" or datetime.now().strftime("%H:%M") == "04:20": await client.get_channel(499245707081940995).send("420!!") @remind420.before_loop async def remind420_before(): await client.wait_until_ready() remind420.start() There is no output. Absolutely no output. I expect the time to returned or atleast a yes. 回答1: Make sure to have all your imports and

ModuleNotFoundError: No module named 'discord'

安稳与你 提交于 2021-01-28 11:40:48
问题 Trying to run my .py file from CMD, but it can't find the discord module >>File 'C:\Users\\****\Desktop\Discord_Bot\main.py', line 1, in module >>import discord >>ModuleNotFoundError: No module named 'discord' Although, when I run: >>python >>import discord It works as intended, any suggestions? 回答1: Go into the terminal and use: pip uninstall discord.py wait a few seconds so it can fully delete it, and then use pip install discord.py . Should work 回答2: Maybe it's the Python version issue.

Issue adding a role when reacting to a post

浪尽此生 提交于 2021-01-28 11:11:44
问题 I'm having an issue adding a role when a user reacts to a post. How I'm wanting it to function is that when a user joins the Discord server the bot will send send a message using the on_join event (for now I'm using the command test for testing purposes). The next step is the on_reaction_add event, when the user reacts to this message the bot will add the role to that user. Here is what I'm working with. I've tested this however, I'm not getting the desired result. (on discord.py rewrite)

How often can I rename discord channel's name?

不打扰是莪最后的温柔 提交于 2021-01-28 10:54:07
问题 This is not a post about HOW to change channel's name (I know it). I have an international server using several bots. And we all depend on UTC time (to coordinate through the world). So there was borned a solution to make a time-bot which will show current UTC-time in the dedicated channel nobody can visit. And yes, precision is necessary, even seconds. I created a voice channel with permissions not to join for @everyone. Everything worked fine, it updated every 1000 ms. Then (after several

Why won't Discord bot recognize commands?

守給你的承諾、 提交于 2021-01-28 08:51:46
问题 I'm making a bot for a pokemon server, and I'm trying to make a command that will give the 'Gym Leader' role to another user. I try using the command, and using the test command, but there is no response in the server nor the shell. import os import discord from dotenv import load_dotenv from discord.ext import commands from discord.utils import get bot = commands.Bot(command_prefix='b!', case_insensitive=True) load_dotenv() TOKEN = os.getenv('DISCORD_TOKEN') client = discord.Client() @client