discord

How to define objects in discord.py rewrite

强颜欢笑 提交于 2020-06-17 00:49:08
问题 As stated in the title, how? I'm really struggling with understanding the documentation as there are no examples of anything. How do I define something like a VoiceState, Member, VoiceChannel, etc... Running on tutorials is fine until you have to start consulting the documentation for something specific, at which point it becomes really frustrating when you have no idea how to define objects or use certain commands... 回答1: A lot of this will come from experience, so don't be discouraged if it

How to Fix Runtime Error: Cannot close a running event loop - Python Discord Bot

耗尽温柔 提交于 2020-06-15 21:22:06
问题 I am trying to create a Discord bot with Python, however whenever I run the sample code here: import discord client = discord.Client() @client.event async def on_message(message): # we do not want the bot to reply to itself if message.author == client.user: return if message.content.startswith('!hello'): msg = 'Hello {0.author.mention}'.format(message) await client.send_message(message.channel, msg) @client.event async def on_ready(): print('Logged in as') print(client.user.name) print(client

How to Fix SSL Error on Windows 10 for Discord Bot

ε祈祈猫儿з 提交于 2020-06-13 06:35:11
问题 I have a Discord bot I've been running on a Windows 10 VM for several months, and yesterday it stopped working with the following error: raise ClientConnectorCertificateError(aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host discordapp.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer cerificate (_ssl.c:1108)')] The only fix I've found online is for MacOS which involves

How to Fix SSL Error on Windows 10 for Discord Bot

99封情书 提交于 2020-06-13 06:35:05
问题 I have a Discord bot I've been running on a Windows 10 VM for several months, and yesterday it stopped working with the following error: raise ClientConnectorCertificateError(aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host discordapp.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer cerificate (_ssl.c:1108)')] The only fix I've found online is for MacOS which involves

Get Message By ID: Discord.js

我只是一个虾纸丫 提交于 2020-06-08 17:01:12
问题 I am doing a report system for a discord bot and I want the player to report a specific message by the id so that the moderators can decide if it is offensive or not. I am struggling to find a way to get the message's text from the given id. Is there a possible way of doing this? 回答1: You can retrieve a message by id through msg.channel.fetchMessage(); The documentation is here. If you want to be able to retrieve a message from any channel by id, you can loop through all channels and catch

Get Message By ID: Discord.js

守給你的承諾、 提交于 2020-06-08 17:00:47
问题 I am doing a report system for a discord bot and I want the player to report a specific message by the id so that the moderators can decide if it is offensive or not. I am struggling to find a way to get the message's text from the given id. Is there a possible way of doing this? 回答1: You can retrieve a message by id through msg.channel.fetchMessage(); The documentation is here. If you want to be able to retrieve a message from any channel by id, you can loop through all channels and catch

Certifacte verify failed: certificate has expired (_ssl.c:1108)

空扰寡人 提交于 2020-06-08 11:52:29
问题 When trying to run my discord bot I'm met with this error: raise ClientConnectorCertificateError( aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host discordapp.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1108)')] It just started happening out of nowhere and happens every time. I'm using python 3.8 on windows 10. What does this mean and how do I fix it? 回答1: To fix

How do I check if message content includes any items in an array?

萝らか妹 提交于 2020-06-08 04:29:05
问题 I'm making a discord bot and I'm trying to make a forbidden words list using arrays. I can't seem to find out how to make this work. Here's my current code: if (forbidenWords.includes(message.content)) { message.delete(); console.log(colors.red(`Removed ${message.author.username}'s Message as it had a forbidden word in it.`)); } If you can't tell, I'm trying to check if the user's message has anything that's in the array forbidenWords and remove it. How do I do this? 回答1: The code you posted

Discord.js not writing data to .json file

早过忘川 提交于 2020-06-01 06:22:11
问题 This is my ban command, im trying to export the code to work within a command handler. Iv had numerous issues with this command but eventually i have almost everything working. The code runs perfectly until the point where it should write to .json file (I changed the .json directory to make sure it was being found, and it threw an error so the previous line of code is definitely running, and its finding the .json). Any help would be greatly appreciated, thank you I have also tried replacing

Discord.js Toggle Commands On Multible Servers

随声附和 提交于 2020-06-01 05:59:05
问题 So i want a discord bot were you can toggle commands on the server the command was writen in. Just for an example: if(cmd === "me"){ message.channel.send(`You <@${message.author.id}>!`); } To toggle the command on/of on any server you would need to write " me on " or " me off ". " me on " Will allow to execute the command on that server and " me off " will not allow the command to be executed on that server. I would like this to work on many servers so no allow on guild etc. 回答1: Keep track