#development
1 messages · Page 1671 of 1
Python, XML, Kotlin, Protocol Buffer, SQL and Rust
I Get A Error TypeError: Cannot read property 'find' of undefined how can i make the "permLevels" defined?
exports.run = async (client, message,) => {
const friendly = client.config.permLevels.find(l => l.level === level).name;
message.reply(`Your permission level is: ${level} - ${friendly}`);
};```
wtf is prototype buffer?
Buffer.prototype?
Well there's syntax highlighting support for JavaScript which is upcoming in new discord mobile updates which i added

hmm..........why do my problems never have a solution 
Apparently this is good ping?
Describe your problem better pls
-207 
do you use the docs?
yes lol
champ*
*Protocol buffer
no, that means your ping is so high that it had to move to the past to be able to connect 
wtf is protocol buffer?
A language
Discord desktop: a
Discord mobile: let's support an unknown lang but forget about mainstream langs
- A Mongoose object is a object, which has keys for doing .save() or running mongoose functions.
- I save my documents in a cache as a non mongoose object
- Want to update the document without using. find() (with .save())
Mongoose is very slow on fetching 3000 documents
thats way they are fetched with mongodb
Adding syntax highlighting support for discord mobile is just absolute pain, written in Kotlin clusterfuck
const Discord = require('discord.js')
module.exports = {
name: 'say',
run: async (message, args) => {
const sayMessage = args.join(" ")
message.channel.send(`${sayMessage}`)
}
} // >say 'hello'
// hello
how do I make this embed , and I did the the #faq but I just dont know how to start
yes
I might implement TextMate support for discord mobile to add syntax highlighting support for almost all languages 
There shouldn't be a big difference??
add official support for jsfuck 
because why not
yes
there is lol, I did some tests, and mongoose uses a lot of ram on queries
Already added JS, let's add JSFuck next time 
https://github.com/discord/SimpleAST/pull/27

Does anyone know why this css is only making the image rounded on 1 side?
.Box2 img {
float: left;
width: 350px;
padding-left: 100px;
height: auto;
position: relative;
top: -20%;
border-radius: 25px;
}
padding on an image?
i have a coinflip bot. Earlyer today it was working fine but now only 1 command works (the most recenetly made one how would i fix this?
No code no help
i have someone helping rn ill let you know if i need anymore sorry
whats the diff between sending a webhook and sending a embed?
ok i have a new problem if you are willing to help
idk what a webhook is but an embed is the following screenshot
ik what an embed is
whats issue
you dont know what a webhook is
oop, sorry late reply and i am trying to make it so when you send my website link on discord it sends the embed with that color
well i have a command but it is only replys to lowercase
if(<message>.content.includes()) use this
show me your message event
me or @slender wagon
you
@bot.event
async def on_message(message):
if message.content.startswith('flip'):
coinflip = random.choice(list1)
await message.channel.send(coinflip)
what would i want it to be
('flip'): its defined as lowercase?
yes
if(message.content.toLowerCase() == 'flip')
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
how can i get the bot 24/7 online any idea ?
where would you like me to put this?
import random
import discord
from discord.ext import commands
prefix = "flip"
bot = commands.Bot(command_prefix=prefix)
list1 = ('Heads', 'Tails')
@bot.event
async def on_message(message):
if message.content.startswith('flip'):
coinflip = random.choice(list1)
await message.channel.send(coinflip)
@bot.event
async def on_message(message):
if(message.content.toLowerCase() == 'flip'):
coinflip = random.choice(list1)
await message.channel.send(coinflip)```
@bot.event
async def on_message(message):
if(message.content.toLowerCase() == 'flip');
coinflip = random.choice(list1)
await message.channel.send(coinflip)
try this ;-;
It's string.lower() in python
oh yh
so message.content.lower()
Are there any explicit docs on discords ratelimits.
I.e X number of req/min for sending, editing, fetching etc.
i have an unscramble game for my bot, and im trying to make it so that the bot sends messages with hints with timeouts, but after the user guesses the word (correct or incorrect) it keeps sending the messages
@earnest phoenix @fierce ether spoonfeeding doesnt help anyone ;-;
;-;
also this is js lmao

how do i get the ping of the bot
a js-python hybrid
ik dumb question
Python?
js
idk
i think ${member.username}

ping.js hm
Don't mind me.
for (var i = 1; i <= 5; i++) {
myArray.push(i);
};
I'm just learning about loops, but regarding the final expression, it executes after the for loops executes the code that is inside the curly braces, right?
yes
Sweet.
???
for (var i = 1; i <= 5; i++) {
myArray.push(i);
};
console.log(myArray);
// Same as
var i = 1;
while (i <= 5) {
myArray.push(i);
i++
}
I guess it is like that.
can you not give people the answer if you dont know it? @earnest phoenix
ups, wrong chat
@tired panther nais dank memer
hey hey @earnest phoenix if you're willing to help people in here, you can do so by giving hints, not by spoonfeeding them with unrelated things to their question 
When I press login on this system I cannot figure out why it will not go to my welcome page can anyone help
https://pastebin.com/hq1BgLqg
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
does anyone know how to create a class in visual studio? i forgot haha (c#)
SyntaxError: Unexpected end of input
←[90m at wrapSafe (internal/modules/cjs/loader.js:979:16)←[39m
←[90m at Module._compile (internal/modules/cjs/loader.js:1027:27)←[39m
←[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)←[39m
←[90m at Module.load (internal/modules/cjs/loader.js:928:32)←[39m
←[90m at Function.Module._load (internal/modules/cjs/loader.js:769:14)←[39m
←[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)←[39m
←[90m at internal/main/run_main_module.js:17:47←[39m
what is my fault i didn't understand
fastest ghostping int he west
aaah
why
kek
-m 698183217215176783
🤐 Muted EFEILGAZHD#9321 (@dusky harness)
yikes
bro
Da fuck happened here
atmods
Can anyone help me on the PHP
@spare goblet is it eeara or eyeara
client.on("message", async message => {
if(["Katsumi#8170", "@Katsumi#8170"].includes(message.content)) {
await message.channel.send(`ddddddddddddddddddddddddd`);
}
})
Why is it that when its the name so : Katsumi#8170 it works but when its a ping like @Katsumi#8170 it does not send anything :v
because thats not how pings appear in the message
if you console.log(message.content) you will see that a ping does not show up like that
bad

message.mentions.users.first()?.id```
if your node supports it
first() can return undefined
you'll get errors if theres no mentions
Cannot read property id of undefined 
they are doing .includes(message.content) tho
which only matches exact message content, and not message includes content
oh shit you right
Driving currently but tomorrow evening I can
i tried doing if (message.content.includes("@Katsumi#8170")) { but same result
as long as it’s not detritus
you mean js const girlfriend = require('../json/kidnapping.json');
Don't worry about it kind of need to have it done today
oh wait nvm ty
i'll let you know im legally blind, 73% on my left eye

So i have been working on how to get data from website to steal their .json file for a whole day now to use it in my own commands instead of getting open source api's and i felt super smart as in OMG i stole your website data .json files muhahaha but now i just feel dumn as in how simple it was and its just the same as a open source api 🥲
thief
how do i get index number of an element in an array?
['foo', 'bar', 'cyan']
i wanna check if bar comes before foo, and before cyan for example
in js?
yup
isnt it like indexOf?
look at me, the python dev who can remember JS 
ty
You can't do that
This is what react does to me 
??? Yes you can lol
^ see
oop
one sec
<meta name="theme-color" content="#03fcdf">
this doesn't seem to be working
Is it in your page <head>?
yepp lesson learned thanks
how can i detect if a url is an image
read the content-type header
whats the difference between using a online open source API and a website get data .json file
Beceuse
and this is a online open source api
https://some-random-api.ml/pokedex?pokemon=pikachu
help
wdym?
k
@opaque fern now it’s saying pull is not defined
how do I do that
sry I’m new to coding
im still learning hahaha
@sinful belfry oi
@rustic nova spam
you got a somewhat complex command handler yet don't know where a variable is? then don't copy and paste code hoping it'll work
@ashen cave no advertising here smh check #rules-and-info
big cringe
I have an array of objects
and each one has these 2 properties
how do I get the object that has the highest ping and how would I get what index in the array it is
thought about Math.max but it doesn't return an index
lol
hmmmmmmm
maybe I can use the find function?
idk
idk just loop through the whole array
i guess you could use the sort function then take the first element (or last, depending on whether you sort it in ascending or descending order), but it is probably quicker to just loop through the array
why? fancy functions like find() and sort() are basically loops too
so you already knew about the sort and find methods, yet came here to ask?
i think it would be slower
<array>.sort((x, i) => i.ping - x.ping) try this?
sorting it would be slower
yeah, sorting and re-ordering an array will be slower, but i guess it takes up less lines of code/is simpler
oh no my bot now takes 0.4ms more to do a command
yeah, well. @marble juniper only wants the index of the highest one. Theres no need to reorder it
considering even big bots spend most of their time waiting on IO
its not really a big issue
[0]
sorting also if it's inbuilt will likely use something like a timsort which is plenty quick enough
ik. but that means that it would need to reorder it
lol
ah yeah
just do Math.min
a map function
and then find
the object that has that ping
lol
what is players in this case?
seems to be like a binary tree would be well suited for this
const n = (((((((header & 0XF) << 16) + d.data.charCodeAt(d.cursor++)) * (2 ** 16)) + d.data.charCodeAt(d.cursor++)) * (2 ** 16) + d.data.charCodeAt(d.cursor++)) * (2 ** exp))
``` dafuq am i doing
Nobody knows.

something cursed
lol
I would never code like that
never in a million days
even my formatter would just wrap it
lol
this is my life 
Faster way of doing it
let highestIndex = 0
for (let i = 0; i < array.length; i++) if(array[i].ping > array[highestIndex].ping) playerHighestPing = i
replace array with the name of the array you're using
Well
5 + 5 * 10 != (5 + 5) * 10
Not all
I wonder who would ever use () as line brackets
FUCKING PHONE!1!
If I want to write LINE than fucking let me
God damn
xD
i'll probably just split it into multiple vars
its the only sensible thing to do
Auto correction... what a bullshit
the line itself is cursed
nah I like my solution
it looks cleaner
LINK
STILL NO RESPONSE FROM GIT
?
I mean
they got flooded after corona virus kicked
kinda
so it can take a while
true
bro, you're looping through the array twice
I mean it works though
well, yeah
it's twice as slow
idk
then you can do whatever you want
my cpu isn't dogshit anyways so its fast anyways
lol
and im not working with arrays that have thousands of objects
wtf is happening with your pc?
Wdym
hmm :^)
That's the background design LOL
nah its just broken
its kinda hard to read lmao
i wanna code but i have no idea what to code
thats transparency without blur right?
code a bot that turns your lights off
Call it Strobot
if i had lights that could do that i'd totally set that up
with a camera on the light as well lmao
a bot that controls your amazon account
twitch plays driving a tesla
i could make a website thing that does the light thing
Sadly tesla lib is python
just port it to js
Uncaught exception, brakes.exe has stopped working
ohno
in react, if you were to make a state variable from a value returned from a hook, how would you do that? something like
const { data: students, error } = useCustomFetchHook("/api/students")
const [student, setStudent] = useState(students?.[0])
j
on the first render, students isn't present, so the state gets set as undefined and can't be changed
are you using a library like react-query?
it's a bit of an antipattern to take the results of a fetch response and put it into state. Libearies like react-query or useSWR will use the fetch result as a state itself
okay
kk
kk
Do keep in mind that heroku only provides 550 hours per month for free which will be renewed every month so what you can do is to create 2 accounts repeat the process and when one runs out of hours switch to the second account.
Links--
Ffmpeg buildpack: ffmpeg buildpack : https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git
Discor...
thanks brb
you can update
ok
from inside your ide
kk
brb
why post a video lul
just say heroku
which btw is not that good of a host
for many purposes repl.it will be better and/or easier to use
hi can i promote my server
no
why
await interaction
^^^^^
SyntaxError: await is only valid in async function
at Module._compile (internal/modules/cjs/loader.js:703:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
at Module.load (internal/modules/cjs/loader.js:628:32)
at Function.Module._load (internal/modules/cjs/loader.js:555:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:826:10)
at internal/main/run_main_module.js:17:11
When I created this
await interaction
.getApplicationCommands("811593908751564812")
.then(console.log)
.catch(console.error);
how do you do that?
Just created in index.js
The fancy thing where you put your code in a box
``` put stuff here ```
you cant use await in the global scope
Okay
nvm
Which is good module for slash command
I use erela.js
Also using command handler I wanted to add slash in all...
i am actually using useSWR by the way, and that's why i was asking
what i ended up doing was setting the state when the data has arrived, something like -
const { data: students, error } = useSWR("/api/students")
const [student, setStudent] = useState(null)
if (!student) return setStudent(students?.[0]), null
the reason why i wanted to put it into a state in the first place was to allow switching between the students
if there's a better way to go about that let me know
lol
how do I push an item to an array then remove it after x seconds?
arr.push(str).then(str => setTimeout(arr.splice(indexOf(str), 1), ms));
If your array won’t change than just use push() and timeout(pop())
nope
im just going ot settimeout it
That’s what I wrote yes
Instead of slicing use pop()
Hi (: if I host a bot with Heroku, could I just register my credit card and have it on during the entire month?
Well I said if it doesn’t change, if it does you can’t use pop of course
is setTimeout, a promise???
replit
Nope
what xD
Just to tell you before I go offline push() isn’t a promise, push().then() makes no sense and won’t work
no
you can make it a promise tho... if you want to make delay functions
Told him already
Doesn’t make sense to create a promise just because he wanna add a simple timeout after pushing an element
More work less or similar effort
https://i.imgur.com/izfPV9N.gif @slender thistle
But his version will throw an error anyways but I told him why already
Which lets me sleep well right now 
(node:14965) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Access
at RequestHandler.execute (/rbd/pnpm-volume/6aa01aae-6f57-434c-8446-c7b36c7ba822/node_modules/.registry.npmjs.org/discord.js/12.5.1/node_modules/discord.js/src/rest/RequestHandler.js:154:13)
at processTicksAndRejections (internal/process/task_queues.js:88:5)
at async RequestHandler.push (/rbd/pnpm-volume/6aa01aae-6f57-434c-8446-c7b36c7ba822/node_modules/.registry.npmjs.org/discord.js/12.5.1/node_modules/discord.js/src/rest/RequestHandler.js:39:14)
(node:14965) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:14965) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
he could do
const wait = (time) => {
return new Promise((resolve) => {
setTimeout(resolve,time);
});
}
Array#push;
await wait(1000);
It have admin perms 🙄
What would be the meaning of pushing an array and awaiting it to be deleted again without doing something meanwhile?
Will just made the code slowly
why even push?
Yeah that’s what I asked myself too
you could directly do stuff
That’s why I said stopping the script to await a timeout, how would that makes sense?
Just sleep(x)
Same result 
Gonna sleep now... you will do I believe in you
I have a status that shows how Manet servers its in and I was wondering if I can make it change automatically I’m using discord.py
can I see?
ty!
p!bump
public class Test implements CommandExecutor {
@Override
public void execute(CommandData data, ArrayList<Command> commands) {
// TODO Auto-generated method stub
ArrayList<String> args = data.getCommandMessage().getArgs();
for (int i = 0; i < args.size(); i++) {
data.getChannel().sendMessage("arg " + i + " = " + args.get(i));
}
// test for command
for (int i = 0; i < commands.size(); i++) {
if (commands.get(i).getCommand().equals(args.get(0)))
data.getChannel().sendMessage(commands.get(i).getCommand() + " is a command that matches args 0");
else
data.getChannel().sendMessage(commands.get(i).getCommand() + " is a command that does not match args 0");
}
}
}
javacord
so what this does is it goes through the list of commands and it sees if anything matches, Is there a more efficianent way to do this or do I have to check every one
just for testing it sends a message if it matches and if it doesnt but, I would theoretically break the for loop and continue if the if statement ever returned true.
I'm assuming the CommandData and Command classes are custom or extensions not from Javacord (I haven't used the library, but seeing the docs say so).
The code you've shared seems satisfactory in that situation. You could make it cleaner by replacing raw loops with higher level loops (e.g. for (String arg : args) {...} and for (Command command : commands) {...}).
And yeah, you could (and should since nothing should match afterwards) break from the loop once a command is found.
ok, thanks, just wanted to make sure I was on the right track; and Im gonna use for loops for rn, forEach scawwy, I should really just watch a video but Im lazy
forEach would be fine if you didn't need to break out of the loop
and yes, CommandData and Command are part of the commandhandler
that too; idk just not comfortable with it yet
lambdas 
in discord.py how can I make a cmd where the bot creates a role with admin perm?
can i get some help with discord.py cogs
Yeah
how to help?
u know how to make bot create role?
Read your library documentation
guys, one quick question, to make an automod that can be enabled/disabled, do i need a db?
yes
hm
In reality its not quick
seems good
Most DBs are free
You just need to host them yourself
Most cloudbased dbs like firebase are just complete rip offs 
what
so what do i need to do
im not english
lets just search "good free db discord" on google
or just install quick.db
or mongoDB
mongodb is fairly easy as its query api uses json, though i would recommend to watch out if you use something like javascript, as its a headless database
headless database??
basically, mysql isnt headless, you have to define what youre throwing in
mongodb is headless, any json you insert, it just saves it, doesnt care if a field didnt exist or if record fields differ from eachother
Never heard someone calling it headless
wait, i might be using the wrong word then, im only running on a few hours of sleep
i might be referring to NoSQL and just messing up with something else, dont know what though
It's all good lol
You mean its schema-less
i still have a question of my own, asked it yesterday aswell so hopefully someone that knows will see.
but is there a correct way to do blue-green deployment for a discord bot?
in order to swap out for a new version without downtime but also without having the bot send 2 responses to a single message due to 2 instances running?
also, yes, i think thats it! thank you
In reality for most designs not really, just tye nature of having to be connected to the gateway like that
What we do is have a standalone gateway and then stateless workers the connect to our internal gateway via rabbitMQ
But it comes with its disadvantages as every worker can get any message from any guild via the event which means you cant really do locally cached stuff
i hoped there wouldve been a solution with something like sharding, ive only heard something about it for bot scaling or something? but i dont know if itll actually be possible to help with it
i just cant really find a solution for it unless i can find a way to control responses from multiple bots at once or if the discord api has a solution honestly, because checking for a message from itself would be a 50/50 solution with the delays probably
simple fix, but message.content.replace('bıdık ', '', 1) ?
might be square brained though, because i have no idea what the python library is capable of
I don't think replace has 3 parameters
Nah sharing is used mostly for big bots and clustering, having the same cluster connect at the same time will still rely on duplicate messages, localised gateway and rabbitmq is pretty much the only sane way
do you know of any github examples for such a gateway? i think i'll leave rabbitmq as a last resort as i want to leave external services as a last option
whats your code atm? feels like you should add an if statement so that the bot ignores itself
oh no, here. placed the replace at the wrong spot
async def on_message(self, message):
if message.content.startsWith('bıdık'):
response = get_response(message.content.replace('bıdık ', '', 1))
await message.channel.send(f"{message.author.mention} {response}")
You need rabbitmq in order to operate a internal gateway
That's what implements the actual ipc messaging
no problem at all
im just thinking, do you think it would be possible to create some sort of pubsub system to prevent double responses in some way?
You're litterally describing rabbitmq
global prefix; prefix = "$"
now trying to change ^ with
import god.config as c
c.prefix(message)
^ returns str is not callable
oh, i might have to do some extensive research into it then, but thank you for the lead then!
yes im dumb for not making config a json
and if i do c.prefix(str(message)) same shit
what is god.config
and what is god.config.prefix
if it's a dictionary use keys
god.config.prefix would be first line
and god.config is just a class
with globals
prefix is a string so idk what you're trying to do with it
change it goon

wait
this is probably cancer to look at
i use sharex, will links work in here?
yes
okay wait for the embed
dont mine the name
mind*
im probably dumb tbh
What are you trying to do with prefix
it's a string so why are you calling it like a function
trying to make it changeable
usings cogs so multiple files yknow
shouldve just made it a json but wayyy too late for that
x = "hi"
x("sup")
#?? wtf
that's now how it works
what do you expect to happen when you call a string like a function
it's like doing
"hi"("yes") and expecting it to do something
no
then
It's not too late to readjust your prefix system
You just replace the prefix string with an empty dictionary aka {} and then use prefix.get on it
me rn
then id use .update i assume
I'd only use update if I were to update multiple keys
oh ye im dumb
fucks sake. i was up till 3:30am trying to get my lightweight websocket code to work.
it turns out that discord's servers assume something that is optional
basically, you cant send a frame to discords gateway that doesnt have the MASK bit set
even though according to the spec setting MASK is optional... so you have to set MASK to 1, and then set the mask xor values to 0, because any value xor zero is itself
massive facepalm.
i couldnt fix it last night, passed out over tired at 3:30am, to get up this morning and try again. i decided to turn on the lowest level of debugging on websocketpp and see what it was sending. that was the only difference, well that and gzip compression of the frames
it's now changed my error i get back from 1002 to 4004, 4004 being invalid token, which is what i expected to get.

Shivaco now if i change prefix and i have command_prefix=prefix.get("prefix") will it update automatically or do i need to run a check?
probably need to check if it was changed ?
You should pass a callable instead
prefix.get just returns static string
ooh
I'm watching R6 videos
so what's going on here
you want to create a function specifically to pass it into command_prefix
from the given args iirc it's message and the bot client?
well, since you don't need both, you could just do *args to ignore them 

yeah
wait till you hear about stackoverflow
async def get_prefix(bot_obj, message):
if message.guild:
try:
return commands.when_mentioned_or(bot_obj.prefixes[message.guild.id])(bot_obj, message)
except KeyError:
bot_obj.db.prefixes.insert_one({"guild_id": str(message.guild.id), "prefix": "*"})
bot_obj.prefixes[message.guild.id] = "*"
return commands.when_mentioned_or('*')(bot_obj, message)
return commands.when_mentioned_or('*')(bot_obj, message)
still wondering how my code manages to run even
wtf
my changeprefix code works now but since .get is static im fucked
shiv, you can omit the return in the except 
couldnt i just be janky and reload the main load.py
lmfao
Just make a function that takes client and message object, and return the prefix.get from there. The function then will be passed to the command_prefix parameter
lets see how janky i can make it first
lambda *args: prefix.get(...) should work doe
too much work janky time
thank you guys everything is perfect now
much love
How does the “/“ integration work? I wanna test it out on my dummy bot
slash commands?
Ya
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Hey, uh, I just wanted to ask if this is the right way to make a MUTE command in discord.py:
@commands.command()
@commands.has_permissions(manage_roles=True)
@commands.guild_only()
async def mute(self,ctx,member : discord.Member,*,reason:str="Because"):
guild = ctx.guild
mutedRole = discord.utils.get(guild.roles,name="Muted")
if not mutedRole:
mutedRole = await guild.create_role(name="Muted")
for channel in guild.channels:
await channel.set_permissions(mutedRole, speak=False,send_messages=False, read_message_history=False,read_messages=False)
await member.add_roles(mutedRole,reason=reason)
await ctx.send(f"Muted {member.mention} for reason {reason}")
await member.send(f"You were muted on {ctx.guild.name} for reason {reason}")
id allow them to read messages and history, add_roles with reason?i could just be dumb though
it'll show in the audit logs
when i run this i just get defined in the console even tho i am saying something```js
module.exports = {
name: 't',
description: 'test',
async execute(message, args) {
const filter = (m) => m.author.id === message.author.id && !message.author.bot;
//message.channel.send('Moved conversation to DMs');
message.channel.send('say something')
const msg = await message.channel.awaitMessages(filter, { max: 1, time: 10000 });
console.log(msg.content);
}
};```
msg is a variable
And you send a message in the next 10 seconds after you call the command?
yes
changed the variable to "fsalg" and still didnt work
what... how would that change the problem
already told you, msg is a collection of messages
to get the first message do msg.first()
@latent willow Damn I thought I saw you xD
haha
faker


...
That sometimes happen, you can ignore that
that sounds like a dns error
i need do detect if a user react on a message with a specific reaction and i have looked around on google a bit and i haven't found anything that works for me. i always get an error where something isn't defined
well the issue is that you are copying and pasting code without understanding it
if you knew what it was doing, you wouldn't have something undefined
i know i dont understand what i am doing
I suggest learning a bit of the language you are trying to code in
this is one of the things i have triedjs if(emoji.name === '👍') { }
i am not that smart
and this is the error i getemoji is not defined
what should emoji be?
How could i get something like "id" or "guild" from this using eris? Every attempt I've made is showing undefined.
thats an array of members
so you would need to get the member ex. arr[index].id or arr[index].guild.id
I wrote that a year ago, give me a break 
as long as it works™️
Ill try again. What i have done is asking a few questions then i put those answers in an embed to show the answer to the user and check if he didnt make any mistakes. After that the bot is reacting with 👍 and 👎 and if you are happy you react with 👍 and it will be send to a dedicated channel but if you react with 👎 it does nothing. Where i am stuck and need help is for the bot to detect if a user reacts with ether 👍 or 👎
after discord adding slash commands for bots i cant use my own bots commands if there is rythm bot in the server, should i change the prefix and just not use "/"
You should consider it, yes. it's not just about rhythm, it's just not a good prefix overall
You already had a conflict with the core discord features, but now you have more conflict, so... yeah, change it.
true or i could work a little also and add slash commands for my own bot
Yes, you could also do that.
thanks for the help!
this is the code i currently have```js
module.exports = {
name: 't',
description: 'test',
async execute(message, args) {
const testBounty = new Discord.MessageEmbed()
.setColor('#0099ff')
.setTitle('Bounty')
.setDescription('React 👍 if this is correct and react 👎 if this is wrong')
.addFields(
{ name: 'WANTED', value: Placeholder, },
{ name: 'Condition To Claim', value: Placeholder, },
{ name: 'Reward', value: Placeholder, },
{ name: 'Additional Info', value: Placeholder, },
)
message.channel.send({embed: testBounty}).then(embedMessage => {
embedMessage.react('👍');
embedMessage.react('👎');
});
if(reaction.emoji.name === '👎') return; //here is where i need help
if(reaction.emoji.name === '👍') { //here is where i need help
const Bounty = new Discord.MessageEmbed()
.setColor('#0099ff')
.setTitle('Bounty')
.addFields(
{ name: 'WANTED', value: Placeholder, },
{ name: 'Condition To Claim', value: Placeholder, },
{ name: 'Reward', value: Placeholder, },
{ name: 'Additional Info', value: Placeholder, },
)
return message.channel.send(Bounty)
}
}
};```
What you need is a reaction collector.
you're missing that
you'll need to attach that on the embedMessage variable.
I am having a strange issue writing in Discord.py
Whenever I try to do a @sour pine.command it doesnt work
import discord
import os
from discord.ext.commands import Bot
from discord.ext import commands
from keep_alive import keep_alive
import random
import json
from prsaw import RandomStuff
rs = RandomStuff()
response = rs.get_ai_response("How are you?")
print(response)
#rs.close()
client = commands.Bot(command_prefix = "&")
bot = commands.Bot(command_prefix = "&")
commandList = "Here is a list of commands!\n \n&help: Displays this message\n&whomadeyou: Displays the username of the bot developer"
@client.event
async def on_message(message):
if message.author == bot.user:
return
if message.content.startswith("&aichat"):
print("Hello World!")
if message.content.startswith("&whomadeyou"):
await message.channel.send("GhostbusterJeffrey#5377")
if message.content.startswith("&help"):
await message.channel.send(commandList)
@client.command()
async def test(ctx, arg):
await ctx.send(arg)
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
await client.change_presence(activity=discord.Game('&help for help.'))
keep_alive()
client.run(os.getenv('TOKEN'))
When I go in my server and type &test hello it does nothing
Because you have nothing responding on &test
wdym
Is there a string that allows me to disable strict mode?
so message.channel.send({embed: testBounty}).then(embedMessage.createReactionCollector(filter, [options]) => {?
i did
TypeError: message.channel.send.createReactionCollector is not a function i get this error
Right so why are you trying to attach that to message.channel.send?
that doesn't make any sense at all
I was trying to use on_message event for shorter commands like &help and such but i guess I cant
There's nothing bad with using the commands extension for small commands imo
oh god now im having another issue
discord.ext.commands.errors.CommandRegistrationError: The command help is already an existing command or alias
with this command
@bot.command()
async def help(ctx):
await ctx.send(commandList)
pass
bot.remove_command("help") right after declaring your bot object
P.S. I suggest you rely on bot.commands to list your commands dynamically instead of hardcoding them into a string
(node:9986) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
description: This field is required
at RequestHandler.execute (/rbd/pnpm-volume/6aa01aae-6f57-434c-8446-c7b36c7ba822/node_modules/.registry.npmjs.org/discord.js/12.5.1/node_modules/discord.js/src/rest/RequestHandler.js:154:13)
at processTicksAndRejections (internal/process/task_queues.js:88:5)
at async RequestHandler.push (/rbd/pnpm-volume/6aa01aae-6f57-434c-8446-c7b36c7ba822/node_modules/.registry.npmjs.org/discord.js/12.5.1/node_modules/discord.js/src/rest/RequestHandler.js:39:14)
at async MusicClient.<anonymous> (/app/src/index.js:83:3)
(node:9986) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:9986)
would be better if you showed your code
does anyone know how to make regex for at 1-5 characters long that may be: [A-Za-z0-9] and [@$!%*#?&]
I got to this but it doesn't work: ^[A-Za-z0-9\d][@$!%*#?&]{1,5}$
What is an aio bot?
all in one
your embed has a description field with no values in it
so it’s empty
i have a status that shows how many servers its in and im trying to make it update on its own and i havnt gotten any closer heres what i have
@client.event
async def on_ready():
print('Bot is online and to go {0.user}'.format(client))
game = discord.Game(f"In {len(client.guilds)} Servers! | d/help")
await client.change_presence(status=discord.Status.idle, activity=game)
it should update on its own
lol
im using discord.py in repl.it and it only updates when i press run
set up a task that cycles between statuses and sets them every few minutes
u gotta use uptimerobot i guess
Maybe try changing the status in a different way other then on_ready?
it’s not recommended to change the status in on_ready
is it possible you have any ways i can use do at the top of your head?
You can define a status in the place you’ve placed you prefix
I assume you’ve haven’t done that since you’re using client instead of bot..?
close, ^[A-Za-z0-9@$!%*#?&]{1,5}$
yep
ty!
completely dismissed, cool
i will try
https://discordpy.readthedocs.io/en/latest/ext/tasks/index.html
https://docs.python.org/3/library/itertools.html#itertools.cycle
Two things you need that you aren't using rn
question, does any of you handle chat ranks like meeseeks? and if so, how do you store user levels/ranks?
im trying to figure out a way to use a single map[server id](exp integer), but im terrible at math, is there an easy way to get like exponential levels from just an exp count?
You can try using a database.
like SQLite3
You can use logarithms, sigma, and/or exponents
Probably trigonometric functions too 😛
What do those do?
Mathematical operations
Ah ok
yeah, i store it in mongodb, but i mean more like, i got it as a single exp counter right now in a map where the key is the server id. but im also questioning how others do it, do they have an entire object with exp and level aswell and just make it tick or just have a single counter aswell
I'd believe they have an object with level and current exp
Hi (: I want to run my bot using ts, after compiling with tsc and executing node index.js I have the following errors:
SyntaxError: Cannot use import statement outside a module
Someone knows how could I fix it?
What have you tried in that "everywhere"?
oh i just remembered why i did it like this, database updates are easier as i can just increment the value instead of having to retrieve it and check the levels and exp.
but thank you, shivaco, i'll look a bit at logarithms, sigma and.or exponents? am terrible at math so i guess i gotta put some research into it
vps repl glitch
You can try fucking around with them too, just a side note
i did
It's kinda basic calculus
As for you, what's your issue?
you underestimate how square brained i am
You'll get there eventually 😂
i host the bot but it nerver comes online 😦 
Are you sure it's not your code
wdym
how did you started your bot?
(if you used a VPS)
node index.js
did you have node installed?
yea ofc
did you keep the process open (shell)
got a daemon running?
yea
did you get any errors in the console?
i saw lots of videos none help
did you have some sort of console.log() to show that your bot is online?
(preferable in the ready event)
yea i got it said logged in the bot
with the prefix and the token
and it said online
but it doesnt go online in discord?
yea
shouldnt be the case, but maybe firewall blocking?
did you have more than 1 bot listed in the Discord Developers webpage?
firewalls should not block outbound traffic
yea
did you got the correct token?
yea i did
By default, at least
fr
shouldnt yeah, but still could be if they messed up
I'd be surprised if that was the case
i dont even think there is a firewall configured
sounds like a issue in your code then
a bot doesnt go offline for no reason
have you tried a barebones discord bot to just test if it stays online with basically nothing?
yea i did when i was a noobie
did you got any error when the bot crashed, like one error that yells at you that you got ratelimited, or a unhandled rejection exists the process
no just went offline
enable the debug event, it maybe helps with finding a issue
can u help hosting
i wont host a random bot.
ah
it would have helped me
you said you got a vps yourself
if you still have the vps
cant u do it on a node website
why
i dont have anymore
bcs:
its not designed for Bots
free hosts suck
i mean just try to host
Use node v13+
And in package.json Put "type": " module"
@long stirrup ever tried running the code on your pc?
yea
Worked?
the bot came online for 5 min and then went off
when i did on my pc
can anyone try to run it
Even on your pc ?
yea
SUS
(Give github I'll check the code first before running it)
wdym
ok np
...
create a git repo, and it should show the basic commands to upload it if you made an empty repo
it has my token shit
just go to the developer portal and generate a new one
Now I have this error:
ReferenceError: exports is not defined
done should i send @blissful cliff
im not gonna host unknown code like that, sorry, just assisted as to how to get it on github
can u check the code pls
its 235 js files total, im not gonna debug your entire code, sorry, thats just way too much
umm can u check only some
I'm sorry what the fuck
if you specify which ones you think is causing the problem, sure, but im not gonna look through an entire project
TypeError: Cannot read property 'channels' of undefined
yee bot worked
Well I mean basically it's just reacting to the OP codes 
oh, ah alright
my plan is to replace the one triviabot uses with something where i know how every bit of it works
aegis has some threading problems im really fed up of fighting
sure nothing against self builds
i just use https://github.com/chamburr/twilight-dispatch and RabbitMQ
how to fix this
help
TypeError: Cannot read property 'channels' of undefined
yea how to fix
<something>.channels...
your var something is undefined
what don't u understand?
which line
Have you tried reading the error
It's a inbuilt thing however not every websocket client treats them the same, which i imagine is why they originally chose to not use the inbuilt system, for example Firefox ws wont auto send a ping to the server but will auto respond to a ping (mostly) while chrome will do both, but equally both systems can be hit or miss
no
The stack trace is telling you the line
milrato bot... so forked?
You should start learn the basics of your programming language before copying stuff and trying to edit it.
i dint dude
Litterally looks like it's directly cloned from the main branch of https://github.com/Tomato6966/Milrato-Discord-Bot 
The official Repository for MILRATO | invite: https://dc.milrato.eu - Tomato6966/Milrato-Discord-Bot
i was trying
i was trying to get it to work
i alr have my own bot




xD

good luck stacking them
most likely my log files are gonna be the size of an elk
they heavy
looks like a deer tbh
fun fact of the day, js Math.pow and the ** operator are slow af sometimes for no reason
Get the fuck outa here!
We got an fun fact of THIS day already.
Brain: heres a fact of the day
well now you have one more
One fun fact per day is enough
alright, gonna watch you, old men
Fun fact of they day, Lua has possibly the fastest JIT compilers ever made capable of out performing even Native languages
brb rewriting my bot in lua
better use PHP, that's a good language for people in our age
only fun fact i can think of in such a short time is that a giraffes nerve from the eyeball goes all the way down its neck to its shoulderblade and back all the way up to its brain... dont know if its useful for development but just be happy that our evolution isnt that stupid

Gotta love it when you're getting Seg Faults and SigAborts in Rust mixed with Python 
im getting the tools out to start manually sifting though memory pages 
me trying to upload a damn .log file to kibana 
gonna post something for newbies to read
hey there @quartz kindle 🙂
and no its not some rant or insult or something
so i was up till 3:30am last night trying to get my lib to connect.... turned out discord have some oddities in their websocket server. couldnt fix it, fell asleep. within 30 mins of waking up i'd fixed it. I looked at what websocketpp did.
What is a self bot?
@thin echo a bot using a client token
I have been seeing those reasons a lot
theyre against the terms of use, you use one discord ban you
arent like discord cli-clients seen as selfbots aswell technically?
or is that a seperate specific thing against tos?
If you are coding a Discord bot for the first time please read the following
A Discord bot is not a simple task. Sure, you can use a Discord bot to learn a language, but unless you are proficient in other languages it is not a beginner task.
A Discord bot consists of many different parts with varying degrees of complexity. As a developer you must be able to understand these components.
If you are interested in becoming a programmer or writing Discord bots in the future it is highly recommend learning a programming language to an intermediate level beforehand.
To fully learn a programming language, you can take a look at the respective guides pinned in the channel here.
Why am I asking you to learn a programming language properly?
Look at https://meta.stackoverflow.com/a/258208 for the reason why.
although it does not fall into the category of "selfbot" (as in if it does not have automated responses and the likes etc), but it is still against ToS to use it on an user account (without the
) as you can only use the official client to access Discord, as stated in the ToS
help vampires? why would i want to help vampires? they want to drink my blood!!!
+startbot
this
but in this case they would drain ur nerves
lol
to some degree
hi :3
@quartz kindle also hi tim uwu
yo guys check out how stupid this is
Tim, what do you think about the statement I made above?
lol
or make you immortal, but at the sky high price of never tasting garlic bread ever again
id rather die then
^^

I’m not after emotes why did I get this error
