discord

Discord.js V12 Rude words filter not working

自作多情 提交于 2021-01-28 03:41:44
问题 so I am adding like a rude words filter, whenever someone says that word (lowercase or uppercase) it deletes their message and replies back with something and then the reply gets deleted in a few seconds. Here's my current code, but it doesn't read the rudeWords and doesn't do anything when I write any of the rude words in the chat. client.on('message', message => { if (message.author.bot) return; let rudeWords = ["kys", "kill yourself"]; if (message.content.toLowerCase() === rudeWords) {

Discord.js : reaction.message.guild.members.find is not a function

戏子无情 提交于 2021-01-28 00:19:37
问题 I am trying to make a Discord.js bot that add the "Joueur" role to the user who reacted with the ✅ emoji. I am new to JS and I found the reaction.message.guild.members.find function on the Internet but I somehow get the error TypeError: reaction.message.guild.members.find is not a function and the role is not added. Here is the part of my code : client.on('messageReactionAdd', async (reaction, user) => { if (reaction.emoji.name === "✅") { try { reaction.message.guild.members.find('id', user

ModuleNotFoundError: No module named 'cogs'

百般思念 提交于 2021-01-27 22:00:09
问题 I wrote a discord bot that uses cogs. Here's my code for loading in each extension/cog: import discord import os from discord.ext import commands client = commands.Bot(command_prefix= '.') @client.command() async def load(ctx, extension): client.load_extension(f'cogs.{extension}') @client.command() async def unload(ctx, extension): client.unload_extension(f'cogs.{extension}') @client.command() async def reload(ctx, extension): client.unload_extension(f'cogs.{extension}') client.load_extension

Discord.js awaitReaction chained promise after message.react collect the reaction as promise isn't resolved

偶尔善良 提交于 2021-01-27 16:52:39
问题 I was playing around with the message.react function and the awaitReactions function and I noticed something that bother me. I was trying to determine if I should use a collector or the client.on('messageReactionAdd') (that is another question) for the following method: sending a message adding reactions to it doing something every time a reaction is added (for X seconds) So I made a simple example to start, with a filter which return true every time, and I noticed that the collector was

pick a random item from a javascript array

筅森魡賤 提交于 2021-01-27 15:05:18
问题 I am making a bot that can respond to my messages. If i send Hi! to the bot, it will answer With Well, hello there! . I was just wondering, what do I do to give the bot multiple choices of answers? Is there a way to pick a random item from a responses array using JavaScript? 回答1: Use Math.random * the length of the array, rounded down, as an index into the array. Like this: var answers = [ "Hey", "Howdy", "Hello There", "Wotcha", "Alright gov'nor" ] var randomAnswer = answers[Math.floor(Math

Discord.py SSLCertVerificationError

倖福魔咒の 提交于 2021-01-27 14:15:53
问题 I have been working on a bot and last night it was working just fine operating as needed but this morning when I opened the bot in my terminal I got this following error: Traceback (most recent call last): File "d:/Documents/Bots/DS BOT/bot.py", line 58, in <module> bot.run(token, bot=False) File "C:\Python38\lib\site-packages\discord\client.py", line 640, in run return future.result() File "C:\Python38\lib\site-packages\discord\client.py", line 621, in runner await self.start(*args, **kwargs

Creating Rule agreement when someone join

大城市里の小女人 提交于 2021-01-27 09:37:28
问题 I want to a bot that will set the new member to a role that can only view one channel and have to agree on rules in order to use the server. I have wrote this to do it but I keep getting this error. Ignoring exception in on_member_join Traceback (most recent call last): File "C:\Users\ezter\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\client.py", line 307, in _run_event yield from getattr(self, event)(*args, **kwargs) File "D:\programing\Discord Bots\Osis Nation\Start.py",

Creating Rule agreement when someone join

情到浓时终转凉″ 提交于 2021-01-27 09:36:33
问题 I want to a bot that will set the new member to a role that can only view one channel and have to agree on rules in order to use the server. I have wrote this to do it but I keep getting this error. Ignoring exception in on_member_join Traceback (most recent call last): File "C:\Users\ezter\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\client.py", line 307, in _run_event yield from getattr(self, event)(*args, **kwargs) File "D:\programing\Discord Bots\Osis Nation\Start.py",

How to react to a specific message (discord.py)

纵饮孤独 提交于 2021-01-27 07:40:48
问题 I'm coding a suggestion bot that's supposed to send a player's suggestion to a suggestions channel in my server and react in the suggestions channel with some emojis. The problem is that using 'message' as the Message parameter would react to the message sent to trigger the code, but I want it to react to the message the bot sent to the suggestions channel. I'm fairly new to coding. How can I get the bot to react to a message in a different channel? text_channel = client.get_channel(

discord.py rewrite: TypeError: cogs must derive from Cog

我是研究僧i 提交于 2021-01-27 07:09:57
问题 As my bot is getting bigger, I'm trying to implement cogs, however I have ran across a problem. I have my whole code set up and ready, but for some weird reason I keep getting this error: Traceback (most recent call last): File "C:\Users\Lauras\Desktop\Akagi Bot\main.py", line 107, in <module> bot.add_cog("cogs.fun") File "C:\Users\Lauras\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\bot.py", line 477, in add_cog raise TypeError('cogs must derive from Cog')