Questions tagged [discord]

0

votes
0

answer
5

Views

how to fix events not working after restarting the bot

i have a problem with the message reaction, i made the bot to delete any message sent on channel names appeal and send it to another channel names the appeals and react to the message with :white_check_mark: and if someone reacted to the message with the :white_check_mark:, the bot will automaticly...
iTzMuntadher
1

votes
2

answer
1.9k

Views

How to detect if a message is edited?

I am intending for my bot to allow only 'ew' to be sent in chat. I have resolved majority of the work-arounds, however, there is one I can't resolve independently. When someone posts 'ew' in chat and then edits the message to something else, it remains like that without being deleted. How could I re...
Brandon
1

votes
2

answer
518

Views

Regex Pattern for All Discord Tag Types

doing some discord.js bot development and I'm trying to create a regex that will filter out all types of discord tags (aka tagged users and custom emotes). I've tried a few different things, but none that will capture every case. The 5 main styles of tag are: (User) (User) (Emote without number in n...
R. Gillie
1

votes
1

answer
88

Views

Discord rich embed buttons

I made a few discord.py bots, but I came across one which was surprising. It's called IdleRPG and uses rich embed messages with buttons. Here's a pic (note the buttons at the bottom of the menu): I've tried contacting the developer and been searching the net but can't seem to find how they did it. D...
Legion
1

votes
2

answer
55

Views

Cannot resolve method 'buildAsync()'

I used to develop bot on JavaScript, but because I code a lot on C++, I decided to move to Java. I found a tutorial and they told me to use Gradle. I followed the instructions and now have this code: import net.dv8tion.jda.api.JDABuilder; import javax.security.auth.login.LoginException; public class...
The Developer
1

votes
1

answer
26

Views

addRole to a mentioned user isn't working

I'm trying to make a discord bot, which can add a specific role to an user. const Discord = require('discord.js'); const client = new Discord.Client(); client.on('ready', () => { console.log(`Logged in as ${client.user.tag}!`); }); client.on('message', (message) => { let allowedRole = message.guild....
Sir Cyborg
1

votes
1

answer
53

Views

Problem with triggering a (chat-triggered bot) only every 5 seconds

I would like for my discord bot, to, every 5 seconds, based on if I have just recently typed something in chat, send a message saying 'You have spoken'. For example, if I sent these messages (below) Hi (message #1, one second has passed) Hi (message #2, two seconds have passed) Hi (message #3, thre...
Ibrahim Shah
0

votes
0

answer
3

Views

Issues with discord bot | charmap' codec can't encode character

i'm trying to make a discord bot with python, my problem is, i want some emojis in the channels names, and when i added the emojis the commands stopped working! Windows 7 Python 3.7.2 Code: channel = client.get_channel(569684483985375242) if channel is not None: embed=discord.Embed(title='Reage com...
xkm-
1

votes
3

answer
150

Views

Discord Bot “Status” from Playing to Watching?

I'm hoping to change my discord's bot status from 'Playing' to 'Watching' or any of the other options but can not understand where to declare this at, can someone please help me? This is the line of code I have for the current status: client.user.setActivity(`${client.users.size} in here buying the...
artvandelay
-2

votes
0

answer
27

Views

Is it possible to start a new line for a number of characters?

Is it possible to start a new line for a number of characters? I need to use it in any embed. For my discord bot.
Dave Tetenburg
1

votes
1

answer
58

Views

With discord.py, whats a way to get my discord bot to display a custom message in the 'playing' section on the members tab?

I am trying to display a custom 'now playing' message right below my Discord bots name in the members list. I looked at open source discord.py bots on GitHub, but it's too complex for me to understand. This is all i have right now: bot = Bot( command_prefix=when_mentioned_or(BotConfig.prefix), activ...
averwhy
0

votes
0

answer
6

Views

Discord.py after pyinstaller I get RuntimeError

Making a Discord bot using Discord.py[voice] the bot joins, leaves, plays youtube audio in channels all that perfectly when I run it inside of PyCharm, but when I convert it to an .exe using: pyinstaller --icon=icon.ico Bot_Spud.py And then run the .exe, join a voice channel and I get this RuntimeEr...
Liam McCullough
1

votes
1

answer
44

Views

MySQL Query crashes my program even when in try statement

It errors out when the record couldn't be found Cannot read property 'id' of undefined How can I keep it from crashing out and handle 'undefined'? let blacklisted = false; let conStr = 'SELECT * FROM `blacklist` WHERE `id` = ''+message.author.id+'''; con.query(conStr, function(error, result, field)...
KillerDogeAlt
1

votes
1

answer
6.8k

Views

how do I bind a bot to a specific chat on discord

I have a couple of bots running on the same server and they are responding to the same messages. I want to bind each bot to different chat channel so they would only respond to the messages meant for certain bots.
N01SE Productions
1

votes
0

answer
135

Views

Discord Webhooks and JSON construct limits for non-OAuth apps

I'm trying to clarify whether or not it's possible to POST JSON to a Discord channel webhook, without requiring a fully fledged OAuth authenticated app, and have it display more than a single line of text. I can successfully send data to the webhook endpoint (using PowerShell), but it will ignore an...
Robin
1

votes
0

answer
2.3k

Views

Discord does not embed link when sent by my bot

My code works fine and the bot sends the link, but Discord does not recognize it as one and does not embed it. When I copy and paste it myself, it then recognizes it as a link and embed the image. Here is my code: if message.content.startswith('.dog'): response = requests.get('https://dog.ceo/api/br...
Mark W
1

votes
1

answer
816

Views

How do I create a case statement in discord.js

This code is what i am using now to have a rough idea of what to do bot.on('message', (message) => { if (messege.content.includes) { int (num = 0); switch(num) { case 1: System.out.println('The IP of the server is .'); case 2: System.out.println('The Store is'); case 3: System.out.println('Disord in...
Jake Baalham
1

votes
1

answer
1.4k

Views

Can wait_for_message check for multiple contents?

I am waiting for a message like: msg = await bot.wait_for_message(author=message.author, content = '.hit') What I want to do though is to wait for a message, and proceed with 2 different kinds of content, for example: msg = await bot.wait_for_message(author=message.author, content = '.hit' or '.pass...
Mark W
1

votes
1

answer
845

Views

How can I check if a text channel is already in a category? Discord Rewrite API for Bot

I'm trying to make a ticket function on Discord on my bot, and I was wondering how I can check in a certain category whether a text channel already exists, and if it does, then the ticket won't be created. @bot.command() async def new(ctx): guild = ctx.message.guild channel = discord.utils.get(guild...
SavagePotato
1

votes
1

answer
768

Views

Delete all messages in a channel from my bot

channel.fetchMessages() .then(messages => messages.array.forEach( message => message.author.equals(client.user) && message.delete() )); Tried to do this to delete from TextChannel channel all messages that my bot has sent. Doesn't work, errors: messages.array.forEach is not a function How can I get...
theonlygusti
1

votes
1

answer
1k

Views

How to make the bot speak on another channel? (with discord.py)

I am wanting my bot to send a message to a certain channel, (but I do not put the id because my bot will be public) I used this command: await client.send_message(destination=teste, content='oi (hello)') But it does not result in anything and gives the following error: Ignoring exception in on_messa...
KaigoGames
1

votes
1

answer
77

Views

Python - add trigger words that will trigger POST request

I'm trying to make a Discord webhook poster which will make a post request whenever a file updates (adds a line) with a specific set of words. Let's say the new line has 'TRIGGER WORD', then it will trigger the post request. I have come to making the service read the file but don't know how to creat...
1

votes
1

answer
27

Views

The error with the write data in txt file

PROGRAMM @client.event async def on_message(message): my_file = open('{0}.txt'.format(message.author.id), 'w') myfile1 = open('{0}.txt'.format(message.author.id), 'r') myfile1.read() my_file.write(myfile1.read() ++ number) my_file.close() ERROR Ignoring exception in on_message Traceback (most recent...
SpaRk_PWM
1

votes
1

answer
753

Views

Mentioning a channel with message.mentions.channels

So I simply need a little help on how to do a thing on discord.js. I'm really confused on how to use message.mentions.channels and the Documentation isn't helping. I just need a command that console.log's the channel mentions (like #annoucements) Confused as to how. My code right now is if (args.joi...
Zetari
1

votes
1

answer
1.7k

Views

Add permissions to channel for user

I've recently added this Discord bot to my server: https://github.com/critcola/discord-auto-grouping It's working great and I've modified it slightly to ensure it creates a room based on the user's name, with a user limit and under a certain category in my server. My last edit — which I can't seem...
Dave Maltby
1

votes
2

answer
369

Views

How to include file in heroku but not github

I am making a discord bot and trying to host it on Heroku. I am deploying from github and it deploys fine. I only have one problem: the discord bot logs in with an auth token that must be kept secret, so not on the repo, but is required for the bot to log in. Does anyone know of a way to have a...
The_Bob
1

votes
2

answer
874

Views

Waiting till the promise is finished [duplicate]

This question already has an answer here: How do I return the response from an asynchronous call? 34 answers I'm creating a discord bot, and trying to structure a bit better. message.channel.send(require('./commands/' + inputs[0] + '.js')(inputs)); This will require a file and send the returned mes...
9349u8u3guhir
1

votes
1

answer
292

Views

Got “Unexpected end of input” in Javascript when making a Discord Bot

client.on('message', (message) => { message.channel.send({ embed: { color: 3447003, author: { name: client.user.username, icon_url: client.user.avatarURL }, title: 'commands', description: 'all current commands', fields: [{ name: 'admin only', value: 'ban' }, { name: 'moderator only', value: 'kick'...
isa belle
1

votes
1

answer
357

Views

The channel provided must be a voice channel. error with move_member

import discord from discord.ext import commands from discord.ext.commands import Bot import asyncio import time bot = commands.Bot(command_prefix='$') @bot.event async def on_ready(): print ('Ready') @bot.command(pass_context=True) async def Move(ctx): #channel to move to '414543063575429131' #user...
1

votes
1

answer
14

Views

filter[0].ID is undefined

I am making a Discord Bot add a database entry when a new user joins. To avoid duplicate entries I'm checking if the database row ID already has the members ID in it. My problem is if the member is not in the database it comes back as undefined. var userID = member.id.toString(); var UserName = memb...
James Bacon
1

votes
1

answer
1.3k

Views

Way to check if a channel exists

module.exports.run = async (bot, message, args) => { let ticketreason = args[1]; let ticketname = 'ticket' + ticketreason; message.guild.createChannel('tickets', 'category') message.guild.createChannel(ticketname, 'text'); } So I've got this very simple and basic code here. I am trying to find a wa...
Josh Bowker
1

votes
1

answer
401

Views

404: Unknown Message (Discord.py v0.16.12)

msg = await self.bot.get_message(channel, req['message_id']) channel and req['message_id'] are defined, the IDs are parsed as str (if int, then AttributeError would be raised) and the message is in the channel, yet the console output is this https://i.imgur.com/TVEX9uV.png. The bot has Administrator...
shivaco
1

votes
0

answer
370

Views

Discord.js bot replies itself when awaiting messages

After the bot sends the message message.channel.send('Fortnite added!'); or another roles, the bot replies to itself with the default message until the 5 seconds ran out. const awaiting = await message.channel.send('Awaiting your role(s)...'); const roles = await message.channel.awaitMessages(msg =>...
Keolor
1

votes
1

answer
481

Views

discord.py How to make a bot that private/direct messages multiple people at once?

I'm making a bot that proctors a game that involves pm'ing players secret messages. However, I only know how to make the bot pm one person at a time. Example: @bot.command(pass_context=True) async def poke(ctx, user: discord.User): await bot.send_message(user, 'boop') Is there a way for me to store...
GooeyGreenMuffins
1

votes
1

answer
382

Views

How to send a message to another server from my server?

I need help with this: import discord from discord.ext import commands from discord.voice_client import VoiceClient bot = commands.Bot(';') @bot.command(pass_context=True) async def sendm(member, sv, ch, *, msg): serverd = member.server.id('{0}'.format(sv)) channel = member.server.get_channel('{0}'...
NickTai尼戴
1

votes
2

answer
285

Views

bot keeps repeating

This discord bot keeps repeating what it just said concatenating two strings! Please help! const Discord = require('discord.js'); const client = new Discord.Client(); const prefix = '*'; client.on('message', (message) => { if (message.content == prefix + 'test') { message.channel.sendMessage('```Use...
Nathaniel Herron
1

votes
1

answer
1.3k

Views

Want to add a role when reacting to a message discord.js

I want to have someone get a role when they react to a message. I'm not sure how to start.
MilkyBob
1

votes
1

answer
6.6k

Views

Discord music bot not working

When I run the following script ('node musicbot.js' in cmd) and '!play ytlink' within discord itself, the bot joins the voice channel and logs both the command and the link in the console. Yet, the music does not start playing. I have installed ffmpeg, ytdl-core, and discord.js. Can someone help me...
1

votes
1

answer
186

Views

Absolutely baffling issue with Discord.py bot

I'm at my wits end trying to debug and solve this error. Basically, I have a variable (maxID) that thinks its not initialized when it very clearly is both before and after checking. It only seems to do this in my add method, as it is just fine in all the other methods I've tried (I've left a debug p...
Acemcbean
1

votes
1

answer
114

Views

Skip function on Discord music bot removes all array entries

I can't get tracks to skip on our music bot without it panicking and deleting the entire playlist. More details below. On command, this bot will use YouTube-DL to download a video from YouTube or track from BandCamp and play it back through a voice channel. The track is downloaded, loaded into an a...
Bevan Edwards

View additional questions