Questions tagged [discord]

0

votes
0

answer
3

Views

discord.py rewrite | Problem with getting author message

I've been making a number game command in my server, and someone recommended I add difficulties. So, I have 3 difficulties for the user to chose from. I have already got a bit of code which got the author's response and worked, so I re-used it in my code, and now I am stumped. It may be glaringly ob...
xupaii
0

votes
0

answer
6

Views

How to get a simple text-only page to output onto Discord when requested with a command?

I have a simple code I use to output the number of players on a server currently. It's a simple print_r output, and a h3 tag. I'd like to know how to take the contents of this website and output it on a Discord Server when requested with a command? print_r($result); echo "Players Online"; That's al...
Blair
0

votes
0

answer
12

Views

Body parsing (Superagent, Discord.js)

I want to know how can i parse urls like this into my superagent: ["https://cdn.shibe.online/shibes/798c20a027fc06869366a549187ea85885737361.jpg"], kJBTm.jpg at http://random.birb.pw/tweet/ I am beginner, sorry. I know only the very basics of Discord.js const {body} = await superagent.get .... I wan...
Janko Pjer
0

votes
0

answer
14

Views

How do I send a message a certain channel from a Channel ID

I'm trying to send a message to a specific channel (like a Duck Hunt) in a Discord server using discord.js But when I try to find the channel it returns undefined. I have tried using client.channels.get('ID').send("message");and client.channels.find('name', 'bot') which both return undefined. const...
Claire Kitchen
0

votes
1

answer
12

Views

Implementing a while loop without interrupting the bot's main event loop

I am in the middle of having two of my bots interfacing with each other via a ZMQ server, unfortunately that also requires a second loop for the receiver, so i started looking around the web for solutions and came up with this: async def interfaceSocket(): while True: message = socket.recv() time.sl...
Myronaz
0

votes
3

answer
17

Views

How to make discord bot post in a specific channel?

So I am attempting to make a Discord bot post a message in a specific channel on a server, because it only posts to #everyone. I have looked at many other posts and can;t seem to get it. I am a complete moron at javascript and only know the very basic basics. The goal is when a user says "test" in a...
Elfii
0

votes
1

answer
11

Views

discord.py | Making a mute command, can't get member name

I am setting up a mute command for my new discord bot, I am fairly new to the discord.py stuff, and do not understand what is going wrong. I keep getting the error that a member is not being specified, when it clearly is. I have tried many tutorials on youtube etc, but it always skims over a detail...
xupaii
1

votes
3

answer
17.3k

Views

Make Discord bot send picture with message with NodeJS

I have a few pictures, all on imgur with direct image link (format: https://i.imgur.com/XXXXXX.jpg), and a Discord bot made with NodeJS. I send messages like this: bot.sendMessage({ to: channelID, message: "My Bot's message" }); I have tried this: bot.sendMessage({ to: channelID, message: "My Bot's...
Kaito Kid
1

votes
1

answer
1.4k

Views

how to save an image from discord using discord bot node js

So far I've only been able to get text and links from what other people on my discord channel type, but I want to be able to save posted images/gifs. is there any way I can do this through the bot or is it impossible? I'm using discord.js.
Kyle
1

votes
1

answer
1.4k

Views

(discord.py) Detecting certain keywords in messages

I was planning to make a grammar bot for fun, and I want it to find certain keywords inside a message, rather than just asking if it is ONLY that keyword. I haven't found anything close to what I want. Help?
OffstageAlmond
1

votes
1

answer
2.5k

Views

TypeError: Object of type TextIOWrapper is not JSON serializable

If the code was to work properly then whenever someone types something in the chat they get 5 experience and that information gets put into a .json file, but instead what happens is whenever someone types something into the chat it gives me this error. on_message users = json.dumps(f) TypeError: Ob...
kybt
0

votes
0

answer
20

Views

How do I convert sum of hex values back to hex values

I have an object containing a lot of hex values, which is: var perms = { // General generalCreateInstantInvite: 0x1, generalKickMembers: 0x2, generalBanMembers: 0x4, generalAdministrator: 0x8, generalManageChannels: 0x10, generalManageServer: 0x20, generalChangeNickname: 0x4000000, generalManageNick...
GamesProSeif
0

votes
0

answer
4

Views

Cannot convert from Discord.ActivityType to Discord.IActivity C# Discord.Net

This is the command that i will use when setting the activity but im not quite sure how to set it. [Command("watch")] [RequireOwner] public async Task SetBotWatching([Remainder] string video) { await XyntaxBot.Client.SetActivityAsync(ActivityType.Watching); await ReplyAsync("Set Activity"); }
Ice
0

votes
0

answer
7

Views

Discord client object is undefined after being exported

I've recently run into a problem. For the past several weeks I have been working on some discord bots I have made and am having trouble with exporting the client object. I've been trying to export it to other files so I can hook event listeners in other files using the same object. Below's what I at...
Alex
1

votes
1

answer
161

Views

DiscordJS, Gulp reload bot on file save?

I just started messing around with Discordjs and I'm working on just a super simple bot example, but the most annoying thing is whenever I make any changes I need to stop the bot in command line and execute the command to come back online in order for any of my code changes to take affect. Is there...
NinjaTap
1

votes
2

answer
156

Views

TypeError: Cannot read property 'exp' of undefined

I use sqlite for database in my javascript code and no matter what i try, it's always keeps this error in there: sql.get(`SELECT * FROM users WHERE userId ="${member.user.id}"`).then(row => { if (!row) sql.run("INSERT INTO users (userId, level, exp) VALUES (?, ?, ?)", [member.user.id, 1, 0]); var pr...
Amir Beraha
1

votes
1

answer
5.4k

Views

Discord.js - Cooldown for a command for each user not all users

I am developing a discord.js bot and I want to make a cooldown for a command. I saw a lot of tutorials on how to do it on Google, but all those tutorials do it for all the commands (so when a user type !mycmd all the users have to wait X minutes/seconds until it can be typed again). But I want to do...
usamember
1

votes
1

answer
1k

Views

How to give role to user for reaction

If user add reaction :HotS_Tank: in a special message, the bot will need to give this role to user, but I do not have any idea how to do it... That's what I have tried: async def role_background_task(): await client.wait_until_ready() roleChannel = discord.Object(id='411270826374070293') roleMSG1 =...
SpaRk_PWM
1

votes
1

answer
3.2k

Views

Python message.content discord bot

I would like a help, I am trying to make my bot in discord to respond automatically when someone writes some word, the problem is that the command only works if the word is the first thing to be written in the sentence. I wish my bot could respond to the message even when the word is in the middle o...
Lucas Tesch
1

votes
1

answer
47

Views

Schedule Asyncio task to execute every X seconds?

I'm trying to create a python discord bot that will check active members every X seconds, and award members with points for their time online. I'm using asyncio to handle the chat commands and that is all working. My issue is finding a way to schedule this checking of active members every X second...
Logman
1

votes
2

answer
55

Views

How to use a Discord emoji in a C# if statement

I'm making a shop command for my bot, with the chestnut, ring, tangerine, doughnut and pick emojis in it as a test run. When I try to input the :chestnut: emoji as the item to purchase, it will save it as 'item', but it doesn't seem to be the same as ":chestnut:" in the if statement [Command("buy")]...
Jack Nutting
-1

votes
0

answer
12

Views

Making bots join/leave a discord channel

So Ive been working on a program to make my bots join a discord channel but i keep running into errors this is the codecase "music": message.member.voiceChannel.join();
JackThePug
0

votes
0

answer
3

Views

Making a flexible file path reader for discord.js using fs?

I’ve been working for a while on making commands for my discord.js bot, but now I am starting to categorize them. My commands are currently being put into a collector for a new discord collection (named client.{commandType}commands). I want to make “{commandType}” to be changed out for the val...
Silveradoz
0

votes
1

answer
19

Views

Python How to send individual message for servers

Hello i want to send a individual message for servers when command has invoked. List = ['Server 1 ID' : 'Message 1', 'Server 2 ID' : 'Message 2',] @bot.event async def on_message(message): if message.content.startswith(("!Ping")): if message.server.id in List: await bot.send_message(message.channel,...
Demotry
-1

votes
1

answer
37

Views

Take info off arrays 10 by 10

Im trying to make something like a card game in a Discord Bot, Im kinda new to JavaScript and im stuck in trying to display the inventory to the player. Im using Discords embeds to display it, but having a big embed of 100cards doesnt seem right. I want to take 10 cards at a time, but i dont know ho...
Briggs
-1

votes
0

answer
14

Views

Recording replies in discord PMs

I am currently working on making an application bot in discord, and made a quick test to try to find a way to detect a reply in a PM channel between a user and my bot. After fiddling around with varying google searches and such, my best attempt was this: [Command("apply")] public async Task ApplyAsy...
Praise Allah
0

votes
0

answer
7

Views

Discord.js send user in server a message by User ID

I want to use Discord.js to send a message to a User based on their User ID. So not whenever a user sends a message, but whenever I want. Example code: bot.fetchUser("123456").then((user) => { user.send("Test"); }); Where 123456 is the Discord User ID. This returns a 401 unauthorized error.
Chris
1

votes
3

answer
72

Views

How to make many words all trigger the same thing

What i want is those three words, can, is, and was, to trigger the same bit of code. If can, is or was is in the text i do not want the first bit to run but the second bit instead. bot.on ('message', function (message){ const words = message.content.split(' '); if(words.includes('sans')) { const wor...
Andrew Coalter
1

votes
4

answer
312

Views

Discord window.localStorage is undefined. How to get access to the localStorage on Discord page?

When I run window.localStorage on https://stackoverflow.com it returns the localStorage but when I use the same command on Discord page it returns undefined every time. Is there something that Discord is doing to remove their localStorage from the client side? And if so, is there a way to change the...
sxfvsx8o
0

votes
0

answer
5

Views

I'm trying to make auto role in discord.js and its not working

bot.on('guildMemberAdd', member => { var role = member.guild.roles.find('Member', 'user'); member.addRole(role); }); My Code gives no errors but fails to work, any ideas what's wrong? My bot has permission to manage roles.
Pizzgie
0

votes
0

answer
39

Views

Kicking a user in Discord.Net

I made this code to kick a user from the guild of a discord server The bot console doesn't give me any errors, but this code doesnt work properly when I try to kick a user. What I mean by this is that it doesn't kick the user, and it doesnt output anything in the channel. I also checked the bots per...
R Koekkoek
0

votes
0

answer
6

Views

Problems with Curl in Discord Oauth2

the problem is simple. when the oAuth2 code is sent to the page. This php script to receive the token json not work. Please, help me :c $base64 = base64_encode($data['id'] . ':' . $data['secret']); $info = curl_init(); curl_setopt_array($info, array( CURLOPT_URL => "https://discordapp.com/api/oauth2...
Jasmin Dreasond
2

votes
1

answer
1.4k

Views

Python discord bot - coroutine was never awaited

Well, I'm working on a Discord bot using Python3 and it works to some degree but it keeps crashing every couple minutes. It gives me an error like "Task was detroyed but it's pending". Now, I searched for the problem and came across the information that I had to get rid of my response = request.get(...
Chris
2

votes
1

answer
41

Views

Code will loop itself three time and runs “If” statement twice and “Else” statement once

i do not know why but this bit of code repeats itself 3 times when adding "questionwords" in the message, specifically it will run the else statement one and the main if statement twice. bot.on('message', function(message) { const words = message.content.split(' '); if (words.includes('sans')) { var...
Andrew Coalter
1

votes
1

answer
6.7k

Views

Discord.js send files

I can't remember how long ago it was, but Discord.js updated in the time that I was away and not coding. One of the things that was updated and will be removed in 1.12 (or so I'm told) is the sendFile option. sendFile, senMessage, etc. are all under a single 'send' now. I haven't had any trouble wit...
Pendragon
-1

votes
0

answer
17

Views

How to get two strings and output one for a discord bot

Hello im trying to make it so my discord bot will see that someone has said "im jake" or another name and print out "hi jake". I have tried this: @client.event async def on_message(message): if message.content.startswith("im"): await client.send_message(message.channel, message.content[1:])
StickE
2

votes
0

answer
35

Views

Discord Bot application won't boot up [closed]

I use JavaScript & my app used to work perfectly but then I just edited the console.log(); thing, then the application stopped booting up. I then rolledback, it worked. I reinstalled the rollbacked version and deployed it to my new application. But then again, it won't boot up; here's log: 2018-10-0...
Brands ツ
3

votes
1

answer
46

Views

Is there a way to run an asyncio coroutine using atexit?

I'm working on a bot using `discord.py. The bot makes/deletes several channels, and connects to a SQLite database. If the bot were to crash, I want it to Destroy all temporary voice channels it created. Disconnect from the SQL database. Here's the shutdown coroutine: async def shutdown(self): print...
watersnake
2

votes
1

answer
80

Views

Python get different error response for commands

How to get a different error responses for commands.CheckFailure in on_command_error for different commands. so this is my on_command_error @bot.event async def on_command_error(error, ctx): if isinstance(error, commands.CheckFailure): await bot.send_message(ctx.message.channel, "don't have permissi...
Bosen
2

votes
1

answer
443

Views

Discord.py discord.NotFound exception

everyone. I've been working on a few bots for my discord server and I've come across an issue in one of them which I cant seem to solve. I have a command called 'info', essentially, this command displays some information on a desired user. When I call the command ?info [user], it works just fine unt...
LaughOutQuiet

View additional questions