Questions tagged [discord]

1

votes
1

answer
485

Views

Asyncio “RuntimeError: Event loop is closed”

I'm trying to make a Discord Bot and it has to check an API every minute or so and then send a message to a channel. But for some reason, the loop breaks and ends the task. It's my first time using asyncio and discord.py Traceback (most recent call last): File 'bot.py', line 207, in client.loop.run...
Dicamarques
1

votes
1

answer
2.3k

Views

How to list all members from a specific server?

My code is const list = client.guilds.find('id', '335507048017952771') for (user of list.users){ console.log(user[1].username); } This does literally nothing. There is no error or anything. I just want the bot to find a server and then log all members from said server. Displaying all connected users...
1

votes
1

answer
361

Views

Connecting Heroku Webhooks with Discord

I am trying to have updates to my heroku app sent to a Discord channel via webhook. However, the delivery attempts fail. I've double checked the Payload URL and it is correct. Not sure how to proceed from here.
user3498001
1

votes
0

answer
4.1k

Views

RuntimeWarning: coroutine was never awaited

Been having a lot of trouble lately trying to make my Discord bot simply pull data from Pubg.op.gg and give the user its K/D. I've been getting multiple errors, but the one that is showing up the most is: F:\Python3\lib\site-packages\discord\ext\commands\core.py:50: RuntimeWarning: coroutine 'Pubg...
Yeah
1

votes
1

answer
236

Views

Can't host Discord Bot on Raspberry Pi

I did everything in the tutorial(https://www.youtube.com/watch?time_continue=758&v=kpci6V8969g). When I run the pm2 command, the bot doesn't work. When I try the node index.js command, it displays me this error: async setProvider(provider) { ^^^^^^^^^^^ SyntaxError: Unexpected identifier at createSc...
1

votes
1

answer
1.2k

Views

Exporting/importing in node.js / discord.js

I am currently making a discord bot with discord.js and because I haven't programmed without an html file before I find using several js-files quite difficult. At first i thought using imports and exports was gonna work, but it isn't supported in Node yet. I did some snooping around and this is what...
Dubster
1

votes
1

answer
587

Views

How to modify an image a user sends in Discord using Python?

I'm trying to make a discord command that uses the image a user sends and overlays it with a pre-defined image. I just do not know how to make it work. My command is called 'burninate' and I am trying to overlay a fire image on top of the image a user posts, but I do not know how to correctly make t...
SyntaxError73
1

votes
0

answer
398

Views

Guess my number minigame per discord bot with discord.py

I am trying to code a discord bot with python. I wanted to include this minigame, where I can guess a random number (within 7 tries, that's what the for loop is for). But I get errors, which I can't detect in the code. I honestly think, it's from wrong commands, but I can't know. I wrote the follow...
PschoRhano
1

votes
1

answer
1.2k

Views

How to use discord.py event handler on_voice_state_update to run only when a user joins a voice channel

I am trying to learn how to make a discord bot through discord.py and wanted to add a feature where a message would be sent from the bot whenever another user joined the voice channel that the bot is currently in. I do not know how to use the event handler itself and didn't understand their document...
Sbrunner32
1

votes
0

answer
245

Views

discord.py on_server_join error

I want to make some code that makes it so when the bot joins the server, it notifies everybody. Here's my code currently: @bot.event async def on_server_join(ctx, server): botinvitelink = 'https://discordapp.com/oauth2/authorize?client_id=413782934009675776&permissions=8&scope=bot' for server_member...
1

votes
2

answer
148

Views

discord.py message counter not working

I'm trying to make a message counter with discord.py using the on_message event, but for some reason the counter just stays at 1 all the time, here is my code so you can have a better understanding on what I'm talking about. @cord.event async def on_message(message): global message_counter message_c...
Zen
1

votes
1

answer
694

Views

How can I make a discord bot create a role based on what the person types in the command

I am new to coding and making discord bots, I have gotten it to make a role using a command but I can't figure out how to make it make a role based on what the person puts in the command. For example, !rolecreate test, if I typed that I want it to make a role called test and give it to me. If it hel...
okpls
1

votes
1

answer
312

Views

Command Case Insensitve

How to make below command to work if members use below command in lower or upper or mixing. If members use ping it works. but if members use Ping it not works. @bot.event async def on_message(message): message.content = message.content.lower() await bot.process_commands(message) @bot.command(pass_c...
Demotry
1

votes
1

answer
311

Views

Node.js GET request sometimes receives HTML document instead of JSON and crashes

I am using node.js (and discord.js) to make a discord bot. I am using a GET request with the npm request module. Code works as expected when user types '!cat' it gets data from https://aws.random.cat/meow and posts a cat picture HOWEVER sometimes the server will give a 403 forbidden error which resu...
Todgins
1

votes
1

answer
62

Views

Toggle Feature?

So i'm attempting to make my bot toggle on and off whether or not to send messages in all caps or not. My problem is that when I try to change the variable value it doesn't change. Could anyone help me? New to both stack overflow and programming(ish, know enough to get me this far)
NeedsHelp
1

votes
1

answer
1.3k

Views

How do I add arguments to a discord.py command?

The code I have is: weather = Weather(unit=Unit.CELSIUS) location = weather.lookup_by_location('toronto') forecasts = location.forecast embed = (discord.Embed(title='-=-__THE WEATHER__-=-', color=0x15dbc7)) embed.add_field(name='Clouds', value=forecasts[0].text, inline=False) embed.add_field(name='...
Web Coder
1

votes
1

answer
543

Views

How do I get the username of a member of a discord server from their user id

I've been looking through the docs, and I found the get_members function, but when I used this function and I try to get the name or nick or nickname field, it returns an error saying that the attribute doesn't exist. Here's my code: embed = discord.Embed(title=ctx.message.server.get_member(row[0])....
otherwall
1

votes
3

answer
2.1k

Views

Reload command discord.js

I'm making a discord bot with discord.js, but my reset command isn't working. //!reload if(command === `${botsettings.prefix}reload`) { console.clear(); bot.destroy() bot.login(botsettings.token); message.channel.send('Reloaded'); return; } It doesn't give any error; it restarts and goes back on but...
Tiniux
1

votes
1

answer
773

Views

Bot mention as a prefix in Discord.js

My prefix only works if I do not add spaces to the entire command, example: { 'token': '', 'prefix': '' } const Discord = require('discord.js'); module.exports.run = async (bot, message, args) => { let something = args.join(' '); message.delete().catch(); message.channel.send(something); } module.ex...
Jay
1

votes
1

answer
30

Views

Take JTextField text and display it on JTextarea in real time

I made this program for discord. This program takes your text and puts it in this 'format' that allows discord to convert it to fancy letters. My problem is that while typing the text lags behind by 1 character. I am only a beginner and I don't know what to do to fix it. Ps. I do not feel like usin...
Michael
1

votes
1

answer
97

Views

Labelling positional arguments with Discord.py

How do I force the user to label positional arguments with commands in Discord.py. For instance, I have the following function: bot = commands.Bot('#') @bot.command() async def example_function(ctx, a: int, b: int, c: int): await ctx.send((a+c)/b) How do I force the user to label the arguments? i.e....
Legion
1

votes
0

answer
50

Views

RestAction queue returned failure?

I am trying to make a Discord bot with Java and JDA (Java Discord API). I am getting this error after running this: messageChannel.deleteMessageById(msgId).queueAfter(5, TimeUnit.SECONDS); messageChannel.sendMessage('Survey says... DELETE IT!').queueAfter(5, TimeUnit.SECONDS); They are going to an o...
user9211044
1

votes
1

answer
40

Views

javascript sets - adding value to array in object inside a set

I'm trying to make an array of sets to make something like this { 'user1': ['value#1', 'value#2',...'value#N'], 'user2': ['value#2',...'value#N'], 'userN': [...'value#N'] } and then remove the value#x after 5 seconds (for example). here is my code: var myset = new Set(); var ran = myset[USERID] = co...
Brian Harianja
1

votes
1

answer
95

Views

NOT FOUND (status code: 404): Unknown Message

I am currently working on a Discord bot. I want the bot record all messages it sends on a specific channel. And if a specific text command is sent, I want the bot to delete all messages, then delete the one that the text command targeted and then send the messages again. Current code: import discord...
PGillner
1

votes
1

answer
557

Views

Discord.py how to get bot to print out how many members it has? Also, how do I get my bot to get what a user has said?

So, I want my bot to print out the number of members I have in my server. I get this when I try it: Counter Top MTG has this amount of members: My code is: @client.command() async def report(): x = server.Server.members await client.say('`Counter Top MTG has this amount of members: {}`'.format(x))...
asdwd wdad
1

votes
2

answer
817

Views

Create a group DM Discord.js

I am trying to get my bot to message two people but in the same chat window (like when you add a friend to a conversation). The only thing I've found is how to send to a single person by doing .send(message); How could I add a second person to that conversation? Any examples would be highly apprecia...
user2896438
1

votes
1

answer
642

Views

Make Discord Bot receive file and send the contents to the channel

So I want to make it so that if I do this: I use !command in the channel.. (The bot asks for a file) I send a file The bot should then read the file and send the contents. I tried: await message.channel.send('Send your file please..'); const MSG1 = await message.channel.awaitMessages(msg => { const...
1

votes
0

answer
321

Views

Commands CountDown Timer

So how to add countdown date time to reply, starts count down once that times finishes it will show ended. from datetime import date, datetime, timedelta start = 20/06/20018 11 PM UTC Time zone end = 21/06/20018 11 PM UTC Time zone @bot.command(pass_context=True) async def meeting(ctx): embed = disc...
Demotry
1

votes
1

answer
789

Views

Referring to a member as a variable in Discord.py

I'm trying to make a discord bot that runs chat filter; my end goal is for a bot to have a list of words and if one of those words from the list is said, the bot will add a tally to a member and if they get like 3 then a command to kick from server will run. Creating the list is easy and I know how...
Enzo Romano
1

votes
0

answer
72

Views

Discord Bot: How would I program my bot to read and do functions then return the output in a file?

For a simple example. I would want my bot Cyber, be able to use a command like this. For anyone who wants to know, I'm using Discordia. User would attach .txt file (the raw source is in lua), and comment !encrypt then press send. My bot would recognize and quickly read through the file then do somet...
1

votes
0

answer
301

Views

Making bot have different presence in different servers

I'm trying to make a discord command where users can change what my bot is playing, but it changes for all servers and I don't want that. Is there a way to make it so that it only changes for the server that the user is sending the command from? So far all I have is this games={} @bot.command(pass_...
KowaiiNeko
1

votes
1

answer
851

Views

Discord Bot Event for Members Joining Channel

I want my Discord bot to greet members when they join a channel. I have been unable to find an event that fires when this happens. I have tried myClient.UserJoined += MyMethod; and others but they never get fired as I hope. Here is my main code: public class Program { private DiscordSocketClient _c...
Emery Weist
1

votes
0

answer
444

Views

Cannot read property 'pipe' of undefined

I have little problem with my code ;/ I want to create bot that send random meme from a folder but every time when i try to send it I got error with Cannot read property 'pipe' of undefined This is my code (if u find any thing that will help in that code I will be glad to hear it!) const config = r...
Malutki Siwy
1

votes
1

answer
599

Views

Discord.py: forbidden 403, unable to send message to user - How do I get my bot to iterate through and dm all members in my server? [duplicate]

This question already has an answer here: FORBIDDEN (status code: 403) Can't send messages to this user 1 answer I am able to get the bot to direct message anyone with a specific role using the following code: @bot.command(pass_context=True) @commands.has_any_role(roleCheck) async def dmrole(ctx, r...
Ivan Chan
1

votes
1

answer
44

Views

How to use commands only when a current command is triggered?

This question might be complicated and my brain can't really explain it well so please bare with this crappy explanation, My question, When you trigger a command for example .start it will start let's say a text based game, of course you would have the commands to be able to actually play the game h...
Cupcake
1

votes
1

answer
245

Views

aiohttp.errors.ClientRequestError: Can not write request body

I'm I'm a beginner with python but I'm trying to make a discord bot who send a welcome message when the member join the server. I want to send an image modified with PILLOW in the chat. I made that : if message.content == '.welcome': member = message.author url = member.avatar_url hdr = {'User-Agent...
1

votes
2

answer
1.1k

Views

How do I use a local image on a discord.js rich embed?

I have this code: var datos = ['dato1','dato2','dato3'] console.log ('》' + message.author.username + ' introdujo el comando: ' + message.content + ' en ' + message.guild.name); let embed = new discord.RichEmbed() .setTitle('Datos sobre gatos 🐈') .setColor(12118406) .setDescription(datos[Mat...
dperales555
1

votes
1

answer
1.2k

Views

Discord.py missing required argument

I have a rewrite version discord.py.If message have content, error does not happened.I need that error does not happened if message have not content. My code: @client.command(pass_context = True) def async search(ctx,message): ... some code ... if members_count < voice_channel.user_limit: message.c...
1

votes
0

answer
217

Views

Java+Discord - Creating a transparent frame for Chat Overlay

So I play Destiny 2, which doesn't allow Discord to inject their overlay code since they don't have cheat protection yet. So what I was trying to accomplish was to create a transparent window, which is set to always be on top, which I could point Discord too in order to have the overlay appear on th...
Gomeyy
1

votes
1

answer
59

Views

(Discord) SQLite 2 values 1 column error

I'm a discord bot developer and switched to SQLite I previously had some errors and problems with it but that got fixed. After I created multiple tables I'm getting an error I can't seem to figure out this is the error: (node:17024) UnhandledPromiseRejectionWarning: Unhandled promise rejection (reje...
ChickenDev

View additional questions