Timeouts and Intervals are held in memory, once the process is terminated they will be erased. Therefore; you need to store the muted user, unmute date, and whatever other data needed in a more reliable place like a database. Then you can just initialize a setInterval function on the ready event to periodically scan the database and compare the unmute date to the current date.
#development
1 messages · Page 891 of 1
Does anyone know if residential ISPs throttle Discord bot traffic?
well uh anyone have any python discord bot guide thingy thongy
copy wopy pastey wastey
:)
Not any good ones fully up to date ones atm afaik, although I know some are in the works
@ripe lantern I know MenuDocs has a current discord.py series
cool
I have written many as well :)
Favourite command has to be my speed test command I rekon
What’s that then
Probably.
@iron steeple it runs a speedtest (ookla) on the bots sever (self hosting)
Oh right I thought you meant like a discord server speed test which didn’t make sense
i found this but i dont get it
@earnest phoenix when you double click a js file to run it on windows
by default it does to some microsoft script thing
thats not node neither "browser js" 
i did say it's the windows js thingy
its not javascript, so it will never work
its not a windows problem, its a language mismatch
like trying to run a js file with python
or a jar file with C
or the other way around for js and python
or a mac app file on windows
pm2
or an exe on mac
tim i think he got it now
@earnest phoenix https://discord.foxbot.me/docs/api/Discord.EmbedBuilder.html
Represents a builder class for creating a Rich Embed.
That's discord.net not vb.net
Discord.Net works with C#.NET and VB.NET
hi
can aanyone help me make a timer code4
The only .NET pro I can see.
show relevant code, or an example code of what you have tried, and what you want it to accomplish
Here's code I tried to alter I couldn't find code I altered ```js
var person = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[1]));
if(!person) return message.reply("I CANT FIND THE USER " + person)
let mainrole = message.guild.roles.find(role => role.name === "Newbie");
let role = message.guild.roles.find(role => role.name === "mute");
if(!role) return message.reply("Couldn't find the mute role.")
let time = args[2];
if(!time){
return message.reply("You didnt specify a time!");
}
person.removeRole(mainrole.id)
person.addRole(role.id);
message.channel.send(`@${person.user.tag} has now been muted for ${ms(ms(time))}`)
setTimeout(function(){
person.addRole(mainrole.id)
person.removeRole(role.id);
console.log(role.id)
message.channel.send(`@${person.user.tag} has been unmuted.`)
}, ms(time));
break;
}
});
Can you just members.get with the full "<!blahblah>" string?
I've pulled the numeric ID out, but maybe I didn't need to -.-
hey does anyone know how to do one command to make all messages sent by the bot a embed
If you know the technique for any given message, apply it to the condition that the message came from the bot itself
And hasn't already had the operation performed~
anyone use quick.db here?
can u just say what u want
I just made a leaderboard "xp" but it lists me the XP to use them from all the server, and I would like it to list me as that of the server where I ordered
let TopMsg = db.all(`Msg_${message.guild.id}`)
TopMsg.sort((a, b) => {
return b.data - a.data
})
let bb = TopMsg.map((g, index) => `**${(index + 1)}**) <@${g.ID.split("_")[2]}> / ${g.data}`).slice(0, 10).join("\n")
let embed = new Discord.RichEmbed()
.setTitle("Top 10 des membres sur le serveur")
.setDescription(`${bb}`)
return message.channel.send(embed)```
Anyone been experiencing an increased amount of shard disconnects/reconnects over the last few days?
blame discord
That I was aware of, just seems like today was particularly bad (caused a token issue) which is why I was curios; haven't been able to track down / reproduce what caused a string of them earlier this morning
I don't know if that announcement has to do with mine, because it freaks out and spam a ton of disconnects frequently (like 0.4 seconds) then calms down.
//VoiceStateUpdate
let newUserChannel = newMember.voiceChannel
let oldUserChannel = oldMember.voiceChannel
//TypeError: Cannot read property 'voiceChannel' of undefined```
v11
wdym combine them
@wicked pivot oldMember may be null
@peak fractal you mean this? [http://myurl](http://myurl)
yeah
but wdym combine them?
its label and url
test isnt an url tho?
oh you mean put it inside ` ?
hmm let me check
You need to put the backticks in the label, not around the entire url thingy
You sure? Can you show the string in your code
unction write(){
fs.writeFile("./data.json", JSON.stringify(data), (err) => {
if (err) console.log(err)
})
}```is it good? because my bot doesn't write in json
what's data
it's for temporary stock
you can also bold and italic and even code block it
and the link in code blocks actually works
nasty
[```google.com```](url here)
[```google.com```](url here)
This is weird but never tried it before lol
spicy
I might actually use that trick for something
Keep in mind this isn't the same for mobile @prime cliff
True i wonder how it looks on mobile hmm
I've seen things like this on mobile look like `https://thhisissomemarkdown.com`
LUL
lmao
👀
Phone embeds = sick but weird
const DataVoice = new Map()
bot.on("voiceStateUpdate", async(oldMember, newMember) => {
if(oldMember.user.bot) return;
guild = oldMember.guild
let newUserChannel = newMember.user.voiceChannel
let oldUserChannel = oldMember.user.voiceChannel
if(oldUserChannel === undefined && newUserChannel !== undefined) {
let bal = db.fetch(`Voice_${oldMember.guild.id}_${oldMember.user.id}`)
if(bal === null) bal = 0
DataVoice.set(oldMember.user.id, Date.now())
}else if(oldUserChannel !== undefined && newUserChannel === undefined) {
let total = (DataVoice.get(oldMember.user.id) - Date.now())
db.add(`Voice_${oldMember.guild.id}_${oldMember.user.id}`, total)
}
})```
I was barely a second and it gave me this:
I dont really get it, whats your problem here?
i think the problem comes from here
let total = (DataVoice.get(oldMember.user.id) - Date.now())```
this is supposed to give me the time i'm staying on vocals in ms
mh, i cant help you here. Never used Voicechat stuff 
Sorry.
how do you host discord.js github bot on heroku, every time I try, it changes my token
It changes because a token is composed of a timestamp and the actual code
Just put the token there, it'll work
nsfw must be in nsfw channels only. nsfw cannot be primary purpose of bot.
why does your data get an error
well
what is the error
what is your code about
etc.?
I can't read your mind (or can I)
test
okay it works
i had to reset my wifi lol
anyways
can someone help me fix this error npm ERR! integer@3.0.1 install: `prebuild-install || npm run build-release
cause if i do either of the ones in the both dont work
Could someone help on how to use the command.update https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command.update ?
An example code would be much appreciated
Please mention me in the reply
how do you send a message attachent back?
yeah course I can
Hey, how can i do to check when a 'user/member' joins the guild if it's a bot user DJS v12
bot.on('guildMemberAdd', async (member) {
if(member.bot) {
// Add bot role
} else {
// Add member role
}
})
(I got the role giving working).
member.user.bot?
help me guilds icon url save it SQL erro code ```js
Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'https://cdn.discordapp.com/icons/665282871505977363/fc6b015f823898ce6e66fd1c037f' at line 1
code: 'ER_PARSE_ERROR',
errno: 1064,
sqlMessage: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'https://cdn.discordapp.com/icons/665282871505977363/fc6b015f823898ce6e66fd1c037f' at line 1",
sqlState: '42000',
index: 0,
sql: "INSERT INTO prefix (sid, prefix, servername, serverimage) VALUES ('665282871505977363', '-', 'asd, 'https://cdn.discordapp.com/icons/665282871505977363/fc6b015f823898ce6e66fd1c037fa8cb.png')"
}```
js code js con.query(`INSERT INTO prefix (sid, prefix, servername, serverimage) VALUES ('${message.guild.id}', '-', '${message.guild.name}, '${message.guild.iconURL({ format: 'png' })}')`);

Why is his condition unknown?
I'm sorry
the bot needs to be in this server to have its status show
botum needum to be in serverum (help me)
Ok. Thank you 🙏🏻
Did you say it to me
idk
help meeee pls ```js
code: 'ER_PARSE_ERROR',
errno: 1064,
sqlMessage: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's OOF Shop', 'https://cdn.discordapp.com/icons/500394164484309002/07ca209813a4a3' at line 1",
sqlState: '42000',
index: 0,
sql: "INSERT INTO prefix (sid, prefix, servername, serverimage) VALUES ('500394164484309002', '-', 'Tomo's OOF Shop', 'https://cdn.discordapp.com/icons/500394164484309002/07ca209813a4a3066c074b3bb62767dc.webp')"
why are you storing the name and the icon
Leaderboard system
yes and storing the name and icon is not the solution
why?
store the id and then pull the data from your bot
because the name and icon can change anytime
if it changes it will be updated in the system
and if you store any data that are not ids, you're legally required to encrypt that data
it isn't granted to be updated
they are also encrypted
x doubt
that's not what your sql script says
anyways
md5 encoding
your bot won't have a 100% uptime and you cannot just hope it doesn't go down and updates changes realtime
why?
plus imagine the waste of resources tracking all of the guild changes
what do you mean why
nothing has a 100% uptime
latest server processor i don't think
plus 32 gb ddr4 ram
and 3 TB storage
that doesn't grant it's not going to have downtime lol
plus bot downtime varies from a variety of factors like the bandwidth, the api etc.
so at the moment there was no problem with it so far it has worked that way
just because it works™️ now it doesn't mean it's going to work™️ later
bandwidth = 500+ mb download nad 500+ mb upload
i didnt ask
you're bound to run into an issue sooner or later because this kind of infrastructure is trash
if there are any problems later I will fix it
it will be too late to fix it once you accumulate so much data lol
i dont get why you won't just store the id
store the id and then just let the bot pull actual real time data
and how can i do that?
PHP website and NODEJS bot they run separately SQL goes from one place
oh god
i thought this couldn't get any worse
i thought wrong
😄
why don't you use node as your backend
there are a ton of node web frameworks, most common one being express
because i can't cause js oauth2 error, so i solved it differently
or PHP brings better understanding than node js for website writing
excuses excuses
no excuse just i can't do the login and error please download something i don't get
help node js sql update Special charachter ??
@earnest phoenix Escape your input/Use prepared or correctly parameterized statements
can you help me to make a clear/purge order please?
What language?
Javascript
if you don't understand a simple documentation, you won't even be able to understand us
@delicate garnet check this https://medium.com/discordbot/create-a-clear-command-for-your-discord-js-bot-4cc4547ca3b
Take a look at https://w3schools.com
To be more effective
I mean about learning JS
that is not js that is d.js
Do the privileged intents toggles in the developer portal actually change anything yet or will they come into effect in october?
they're already in effect i think
e.g. you won't receive presence data unless you enable the intent
wassup
i need help
so like
i have in my message handler
let pre = bot.db.fetch(`prefix_${message.guild.id}`)
if(pre) {
message.channel.send(`Howdy there. The prefix here is \`${pre}\`. Have fun!`)
}
if(!pre) {
message.channel.send(`Howdy there. The prefix here is \`db!\`. Have fun!`)
}
}```
but the problem
is that its not like only for pinging it
if you do like
aieufhwiaeufbhiby @..bot it still responds to it
and its not supposed to
only respond to
@..bot
not like a full sentence then ping
then just check if the message content starts with the mention
..?
hm
how would you make it only respond to its own bot mention?
like if its a ping then anywhere else a letter it dosen't yk send it unless its just a alone ping?
by checking for the bots mention lol
isMentioned means if the bot is mentioned in the message, it can be anywhere in the message
mhm
not necessarily the beginning
mhm
mentions are in a <@id> or <@!id> format
simply check if the content starts with either of those two
the thing is
i dont want it still responding like
@..bot h
and it still responds
i want it only to respond to
@..bot
if any other letter is there it denies doing it
then check if the content exactly matches the mention lol
^
no sorry
Ok
that dont even work
I did <@!theid> and I pinged with something after and it still responded
I put both as well
<@theid> and <@!theid>
what's your code
let pre = bot.db.fetch(`prefix_${message.guild.id}`)
if(pre) {
message.channel.send(`Howdy there. The prefix here is \`${pre}\`. Have fun!`)
}
if(!pre) {
message.channel.send(`Howdy there. The prefix here is \`db!\`. Have fun!`)
}
}```
let pre = bot.db.fetch(`prefix_${message.guild.id}`)
if(pre) {
message.channel.send(`Howdy there. The prefix here is \`${pre}\`. Have fun!`)
}
if(!pre) {
message.channel.send(`Howdy there. The prefix here is \`db!\`. Have fun!`)
}
}```
by checking for the bots mention lol **mentions are in a **
and then you said you wanted it to not respond if there was anything after the mention
and then i said what i linked
guys i need help
thanks for dealing with the special ed 
my bot's token is correct but it says "An invalid token was provided"
i regenerate token 3 times but error is same
then it isn't correct
no
computers don't lie
show your client.login()
are you sure you are saving the code / restarting the process
This looks like glitch, so can you truly be sure?
console.log client.settings.token
It's the same as the token on the discord developers page?
yes
I dunno then, are you sure the error isn't from before? I am not sure if the glitch console gets cleaned every time it restarts the process
is your bot online?
i asked this on discord api server and somebody is said me "maybe your bot account got tempbanned"
is your bot online?
@cinder patio yes
so everything is fine?
too much bot is hosted on glitch
are you sure that the token isn't getting invalidated by discord because it keeps getting leaked
check your email to confirm that
Discord also Dms you when it gets reset by them now, i would still say regen it, blocking a little bit of the token is still not good
check your email to confirm that
@earnest phoenix i didn't any mail from discord
try to manually hit an endpoint with the token
how?
if you want, you can dm me your token and i'll test it for you
zoomeyes
That's up to you to trust your bot token to someone
i've tested tokens for many people

you can just regenerate the bot token
but of course, dont do it if you dont trust me
hi
I'm going to drop my question here right away 😂
I have a problem and we do not find the problem, when I launch my bot (with the token "test" it works very well, but when I launch it on the main token, I get no response.
note: the token is correct since it is the same one that works for my colleague, and it works perfectly .. do you have a suggestion? because we dry on our side
thx 😅
i'm trying to create custom commands for my bot but does anyoen kno why commands are not updating in the db?
code:
await guild.updateOne({ $addToSet: { name: args[0] } });
await guild.updateOne({ $addToSet: { response: args.slice(1).join(' ') } })
``` with mongoose
@steep flame how many guilds is the main bot in?
33
are you using discord.js?
yep
does the ready event work?
yes it works with my colleague but with me it launches but does not answer at all ...
client.on('ready' . yes it works
i'm sorry xD
if the ready event works, then the problem is in your code, maybe wrong prefix or something
On my computer with exactly the same code it's run normaly
thx drim haha
^^
i'm trying to create custom commands for my bot but does anyoen kno why commands are not updating in the db?
@digital ibex do you fixed it?
I have,the same problem
can someone explain why 2+1 = 21 in node.js ( fetch a number from a mysql database and use it in a calculation)
aka they need to be a integer datatype
thx
@earnest phoenix no
@lusty quest you gotta do this
parseInt(string1) + parseInt(string2)
You gotta check if they can be converted
Or you can store the numbers as integers/floating points in your database
How to find emoji id from a message that contain emoji?
got it already sorted out @golden condor changed my database column to interger
@thorny meteor what library
discord.js
Ok
@thorny meteor did it work?
whats not what i meant @iron steeple
example : someone sent a emoji in a message
i need to find it's id from the message
Oh I see. I don’t actually use js so that was kind of my limit 😄
@blissful bridge
?
Someone know the ticket command ?
the ticket command
Do you mean how to code a ticket command?
@hasty eagle ticket command for which bot
Is the webhook for voting from top.gg broken or something? Did anything change since 07-04-2020 ?
Should be working
working fine for me
make it urself
It’s not a complicated command so maybe you should look over the basics of whatever language you are using
Why does this return null? It doesn't make sense.
console.log(message.guild.iconURL());
message object is valid, believe me 🙂
and it's sent in a guild
the guild doesn't have an icon?
My bot got declined for this, so.. how do I filter the stuff? cause it uses the urban dictionary api.. and i didnt know that urban dictionary got that soo...
Lock it to NSFW channels
Locking the command to NSFW channels is enough 
You're going to have a hard time filtering stuff
https://nmw03.is-inside.me/WINNcqOs.png
how can I convert "reset" to human readable format.
There should be a method like "fromTimestamp"
yep
Though it seems like how many seconds until something is reset, rather
doesn't the Date object take the first arg as the time
that is "reset date" for ratelimit
new Date(reset * 1000).toLocaleString()
@summer torrent^
@surreal wagon yeah
https://nmw03.is-inside.me/WINNcqOs.png I take this from docs
(node:14048) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'filter' of undefined```this error comes only if i use my invite command in this server
let memberInvites = invites.filter(i => i.inviter && i.inviter.id === member.user.id);
```this line
well show me how u did invites variablr bruh.
let invites = await message.guild.fetchInvites().catch((err) => {
return;
});```
Doe anybody know how to make a webdashboard for your bot?
its basicially a pain in the webserver
you need a lot of endpoints and a bunch of html and interfaces
Is there a way for me to log how many people are in the database for my bot? I was wanting to have it on the status saying something like helping 48 people or something but I’m not sure how to get the amount of ppl in the database.
What do you use for db?
@sullen patrol html/css + backend language
@earnest phoenix idk it’s just a JSON file
What do you use for db?
@earnest phoenix json
you can get the entries where all users are saved, if that is somewhere
and then use .length on it
so Object.entries(userObject).length
Wait I’ll send a pic of what it looks like
(node:14048) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'filter' of undefined```this error comes only if i use my invite command in this server
then you can just Object.keys(require("yourdb.json")).length to make it simple
I hav no idea how to do that
t h i s
I’m new to databases
what is the file name of your "database"
is it in the same folder as your index?
Yh
Object.keys(require("./userxp.json")).length
that code returns the length of the users
servers*
oh wait
users are inside the keys
no
@pale vessel
why would he do that?
i dont know
@sacred mountain lets say you want to set your status like this: Helping x users
Yh
so you want to set your status and in the status you just add that little bit of code
can you tell me which one is user id and server id? like in a clearer way
just want to make sure
Idk
w h a t
I watched a tutorial when I made it 🤣
well from the looks of it the code we gave you is for servers
you dont know how your db is structured
I made it a while ago
again, "how your JSON is structured"
lemme just test something
@sacred mountain can you give me one id of your users
just one
Why
because then i can check if that user exists
and if it doesnt, then that may be a server
?
if it does we know the structure
so its user: {server: {data}}
alright
Ok I hav another question
How do I update the status whenever the JSON file changes
so why are there so many servers for one user?
okay
How do I update the status whenever the JSON file changes
But not the do
Do
*xp
@sacred mountain i dont think there is a way for node.js to detect file changes other than checking it every x ms and checking if the content changed, so i'd just make a 2 minute interval updating the status
yes there is
and that is?
I mean it would work updating every 5 mins or so
But I don’t rlly want that to change every time the file changes at all
I only want it to change when a user is added to it
well figure something out
require("fs").watch("userxp.json",function(event,filename) {
// update status here
})
@sacred mountain
if i read the docs correctly
@earnest phoenix help
that's for filename nm, it's correct
oh i did bot.user.setActivity(Object.keys(require("./userxp.json")).length + ' people spam on ' + bot.guilds.cache.size + ' servers', {type: 'WATCHING'}).catch(console.error)
that works
so just replace "// update status here" with your code
@earnest phoenix you need to make a call to the top.gg api
to check your votes
dblapi.js
but the thing is with ur code u sent that will update whenever anything changed
i only want when a user is added
hM
but its fine
thanks
i will just do timer
wait there is a way but it includes pain
which is by not using json
how will i do a timer function
im searching it now but cant rlly find what i need
?
syntax: setInterval(function() {
// what to do when the interval fires
}, delayInMs)
he wants a "timer"
idk, very vague for me
@sacred mountain do you want your event to fire once in x ms or fire every x ms
every
alright, setInterval
like maybe every 5-10 seconds
setTimeout() === setInterval()?
syntax: setInterval(function() {
// what to do when the interval fires
}, delayInMs)
@earnest phoenix no
K
onReady is good
K
Wait will it use a lot of CPU on my VPS having the timer
Every 20 seconds updating status
does clicking a mouse use a lot of cpu
Anyone here using lavalink able to help me? ^^ (DJS)
you didnt install cogs appearently
what do you use
discord.js because i dont code in python
theres the prob
Hi. I sometimes get this error with my MySQL database:
Error: read ECONNRESET
I guess I can't avoid this error, but how can I solve this. Will this work:
con.on('error', (error) => {
console.log(error.stack);
mysql.createConnection({
host: database.host,
user: database.user,
password: database.password,
database: database.name,
charset: 'utf8mb4',
collation: 'utf8mb4_unicode_ci',
});
});```
Is there a event that fires everytime that a event is fired? Discord.js
dont think so
Ok
I thought that was called a raw event, but can't find it in the docs
@nocturne grove https://tryitands.ee
I can't reproduce an error, or can I?
^
otherwise I should wait and wait
ERRCONRESET is basicially a error fired when a connection resets
yes, so you just need to wait and see if it works
yes but that's a waste of time if anyone here knows it
I mean: low chance it's working after the first try
are you by any chance using a single connection for all of your queries
Any chance someone can help me with this UnhandledPromiseRejectionWarning: TypeError: fields.flat is not a function
update node
Me?
yeah
are you by any chance using a single connection for all of your queries
@earnest phoenix What do you mean? I just create a connection and export that one to all my command files
yeah don't do that
the general rule of thumb is to open a connection, execute a query, close the connection
can't I re-export them after I reconnected the connection?
for every query you do, you open a new connection
cry i've heard of pools, what about them?
but... that's a lot of work
it's not
connection pools are a good implementation however if you want true concurrency, do the above
pooling in node doesn't do much since node isn't multithreaded
hm okay. Just for everything, selecting things from tables too?
yes
every query
Hi. I stopped bot for maintenance. And the bot was declined. If ı open the bot, do you add again?
you need to resubmit it
okay so a kind of global function is the best way to go
pretty much, a service class or some sorts containing your functions
it is
if you notice a performance drop then do look into connection pooling too
i've never used it on node personally so i can't say much
hm okay
so just every time do const con = mysql.createconnection ... and then do con.connect()?
I never did the last one because that caused errors
connect and disconnect after you're done i'm assuming
mysql.createPool({
})
fixed ECONNRESET for me
okay thanks
fixed ECONNRESET for me
@molten yarrow omg but that's a lot easier
:/
hm?
a lot easier than making a connection each time you're doing a query
import discord
import asyncio
import random
import time
import logging
import typing
from discord import Client
from discord.ext import commands
bot = commands.Bot(command_prefix=commands.when_mentioned_or('drip!'))
initial_extensions = ['cogs.fun',
'cogs.help',
'cogs.mod)']
if __name__ == '__main__':
for extension in initial_extensions:`
bot.load_extension(extension)```
????
What's the class called in cogs.fun
its called fun
Screenshot 
Full code please
dont worry i got it
are you embedding the bot page inside the bot description
@pale vessel that's an Outstanding move
shiv already said stop with the markdown didnt they
@pale vessel yep in the detailed description
but why
but why
what do you mean by why?
^
there's no point

anyways if you're trying to embed your own bot page it must be https
no, embed in ur bot page ur bot page, in ur bot page, in ur bot page, in ur bot page.
so basically it would create a cool illusion
lma o
console.log(sentembed.id)
sentembed.react("🎉")
});```
Hello guys, I'm trying to fetch message id, but says "Cannot send an empty message". Why saying like that? Message is sending to channel, but i can't fetch message id.
you can use HTML and CSS inntbe long desc to do that 👀
what are you even trying to do
yes
Reaacting too.
channel.send?
@low bolt show what embed is
oh you defined the channel
const server = client.guilds.get(serverid); const channel = server.channels.get(channelid)
The error said
const embed = new Discord.RichEmbed() .setTitle(prize) .setDescription(`**Time Left:** ${client.time(endat - startat)}\nReact :tada: to join giveaway.`) .setFooter(`${winner} winners | End At`) .setTimestamp(new Date(endat).toISOString());
It sends message
did it send the embed?
shoukaku gang
true.
try console.log(sentembed)
?
import discord
import asyncio
import random
import time
import logging
import typing
from discord import Client
from discord.ext import commands
initial_extensions = ['cogs.fun',
'cogs.help',
'cogs.mod)']
bot = commands.Bot(command_prefix=commands.when_mentioned_or('drip!'))
if __name__ == '__main__':
for extension in initial_extensions:
bot.load_extension(extension)
@bot.event
async def on_ready():
print(f'\n\nLogged in as: {bot.user.name} - {bot.user.id}\nVersion: {discord.__version__}\n')
# Changes our bots Playing Status. type=1(streaming) for a standard game you could remove type and url.
activity = discord.Game(name="I hate lockdown. | drip!help", type=3)
await bot.change_presence(status=discord.Status.idle, activity=activity)
print(f'Successfully logged in and booted...!')```
Does anybody know what mfaLevel is on a guild?
(What does it mean)
probably this https://python.is-stinky.wtf/gmewmlaygj.png
yep
@knotty steeple
Are you talking about guild.verificationLevel or guild.mfaLevel?
Hmm strange
Oh i see...
Anyone using ytdl-core / lavalink & erelajs who can tell me where I did wrong?
I have no errors - so I don't know where I'm wrong ^^
hrm
I was waiting for someone who uses ytdl-core
If you don't use ytdl-core most probably you won't have any idea of what the problem may be ^^ but it's okay, someone is already helping me.
What exactly do you want to do
if isinstance(error, commands.MissingPermissions):
await ctx.send("There's no right for you to be using this command!(Missing Permissions)")```
check permissions
Will I need privileged intent to list guild members, or view bans? Im trying to understand what the whole "Privileged intent" thing means
Do you really need an event for that
Shivaco can my bot awnser if its pinged just to give the prefix information about the guild
yes
Yes
Thx
wait who was that directed towards
me
i mean the question
Do you really need an event for that
wait no i dont
You just apply a decorator to the on_command_error function, that's all you need to make it an event
Most of the time you won't need bot.events
How would I make a message builder that loops through a series of questions which are in an array
For example,
let array = [
"What's your name",
"What's your age?"
]
and it would do a prompt
When i try to do a forEach
it just sends all the messaegts at once
make a loop
u can put awaitMessages in a loop
u can maybe do a function that calls itself

i did that
or use stringbuilder
How long do I have to wait?
@toxic jolt 2-3 weeks just like the dbl approval
hmm
approval is 1-2 weeks but ok
as a function
module.exports = async (message, prompt) => {
const filter = (response) => response.author.id === message.author.id;
const instance = await message.reply(prompt);
return message.channel.awaitMessages(filter, { maxMatches: 1, time: 60000, errors: ['time'] })
.then(collected => {
const content = collected.first().content;
collected.first().delete();
instance.delete();
return content;
})
.catch(_ => {
instance.delete();
return undefined;
});
};
but
when I put it in a foreach loop
I was waiting 2 weeks if I don't guess wrong
it just sends them all at once
use for in loop instead of forEach, that might help.
oo thats actually a big brain
use for in loop instead of forEach, that might help.
@restive furnace How would i do a for in loop if its an array
okay
if you want the keys only, you can do for in loop instead
okay ty
Why I'm getting undefined when trying this function?
db.get("Giveaways").forEach(giveaway => {
const server = client.guilds.get(giveaway.ServerID)
const channel = server.channels.get(giveaway.ChannelID)
const message = channel.fetchMessage(giveaway.MessageID).then(msg => {
const embed = new Discord.RichEmbed()
.setTitle(giveaway.Prize)
.setDescription(`**Time Left:** ${client.time(giveaway.EndAt - Date.now())}\nReact :tada: to join giveaway.`)
.setFooter(`${giveaway.WinnerCount} winners | End At`)
.setTimestamp(new Date(giveaway.EndAt).toISOString());
msg.edit(embed)
return true;
})
return true;
})
}```
@spare goblet so I saw you declined my bot (sorry if this isn't the right place) for allowing anybody to kick (and something else which I just fixed), and I'd like more details about that as I can't replicate it in testing and looking at the code, it should work as intended?
http://alex.is-bad.com/jzY2PeC.png
Does someone know why my webserver sends nothing (http://alex.is-bad.com/6nU3FwJ.png) ?
If I listen on port 80 without using https.createServer it works as expected
DPY how do you do a timed mute?
@wheat jolt prob better ask some server what is focused in these, cause here you probably aint getting help. (i dont know neither)
oki
DPY how do you do a timed mute?
@real bison pls dm me
client.user.setActivity(`${client.users.cache.size} utenti`);
Why this code doesn't set any activity?
@balmy knoll v11 or v12?
@low bolt v12
@balmy knoll the one you used is correct
True :p
Ok i wait
@commands.command()
@commands.has_permissions(kick_members=True)
async def tempmute(ctx, member : discord.Member, time : int):
guild = ctx.guild
for role in guild.roles:
if role.name == "Muted":
await member.add_roles(role)
await ctx.send(f"{member.name} was muted")
if member is None:
await ctx.send("please pass in a valid user")
return
await asyncio.sleep(time)
await ctx.send(f"{member.name} was unmuted")
await member.remove_roles(role)```
is this normal ? https://nmw03.is-inside.me/KmyQKRQQ.png
well try log new Date() and log it and new Date(urtimestampherr)
Shouldn't be unormal?
is this normal ? https://nmw03.is-inside.me/KmyQKRQQ.png
@summer torrent use moment
moment(timestamp * 1000).fromNow()
But it is not very precise
Maybe moment.duration((new Date() - timestamp * 1000)).format('...')
thanks :+1:
how do we check if a user is an admin
what library
dpy
member -> guild_permissions -> administrator
Yeah, is it related to #development, though? 👀
// Send the question in the current channel
message.channel.send(questions[i].question);
// Await for the answer
let answer = await message.channel.awaitMessages(m => m.author.id === message.author.id, {
max: 1,
time: 30000,
errors: ['time']
}).catch(() => {
// If the user doesn't answer to the question, save "The user didn't respond" as the answer
questions[i].answer = "The user didn't respond";
});
// If the user provides a answer, save it
questions[i].answer = answer.first().content;
}```
Uses an Array of Questions and broke over night without changing anything. its still on V11. Did someone got an idea why .content is undefined?.
does it work or does it commit no C lib
It works good on my end
How can i fix this?
hi help im cf
Thx
dont ask to ask
Ok
-ask2ask
Don't ask to ask.
Just ask your question, it wastes time if you say "i need help" or "can someone help me?" instead of just saying what the problem is. Save your time and other people's time and just ask the question.
Please read https://dontasktoask.com/ for an explanation on why this is an issue.
I need help beacuse i have an app named node to create a bot but i am on Mobile
Is there somewhere with like a javadocs-type thing for the Discord api?
So idk how to create a bot there
@gloomy imp https://discordjs.guide/
aha thx
@languid heart literally no idea what u mean
I believe they mean they have a node.js app on phone, and they don't know how to make a discord bot
Discord.Net is an asynchronous, multi-platform .NET Library used to
interface with the Discord API.
I need help beacuse i have an app named node to create a bot but i am on Mobile
Do you not have a PC?
pro tip:* Simply open glitch.com and turn on desktop mode on chrome
For mobile users
you genuinely should not need to use eval
eval is just an another easy way to access your token
how can we retrieve information that if args [0] is not a mention of a channel then its return?
just do the same as you would check for mention, but with # instead
<@ botid> <# channelid>
you can also check for role mentions <@&role-id>
huh, so mods can add a way to check if they are pining the mods, then they can automatically send a warning when they do
just wanted to circumvent a series of switch cases
I'm aware eval is evil
but that code theorhetically handles any length of menu i toss at it
where is m defined and what is m
m is just a library of data blocks
I mean you could use bracket notation
could probably avoid defining the domain with a line of code too
just wanted to see it work
Hello, i Have a question. Is there an API to check if someone voted for your bot?
Curious for future development.
Does anyone know how I can make the server count on the website working?
Hello, i Have a question. Is there an API to check if someone voted for your bot?
yeah https://top.gg/api/docs#bots (Individual User Id Voting Check for the past 12 hours.)
If you're using a library, there may be a built-in method for it.
thank you
if(!captchaChannel) return message.channel.send("❎ | **Veuillez mentionner le salon de vérification et le rôle de verification souhaité.\nExemple: `c?setup #channel @role`**")
let captchaRole = message.mentions.roles.first()```
either a library or manually, which is in the documentation
Is good for roles? I don’t sure
Oh so there's a library
@sudden geyser ahh thank you :)
I'll check into it once my bot is accepted.
I want to make my bot read if a member has a role, but rather than by ID, how do I check it by name
Is good for roles? I don’t sure
@earnest phoenix did you try it?
with find function @fallow quiver
like what are you trying though
args[0] = mentions.channels()
args[1] = mentions.roles()
@sudden geyser
Don't use first() for both vinx. I'm not sure it will work.
confused, is that actually in your code?
Use args, get the id and it'll work properly. @earnest phoenix
for channel use .first() and for second option you can just slice it up and use .get for the ID it resulted
you can still use .roles.first() though
.first on the Collection instance gets the first item in the collection.
try your first method, if you have errors use the method I've said earlier @earnest phoenix
So if I have Collection<Snowflake, Role> (collection of roles), using .first() on it will get me the first Role.
Yeah, mention is not the collection so it should work for both
my method is useful in case you have 2 of same collection ^^
a collection is a fancy name for a map tbh
yeah
Someone new reading the docs wouldn't understand what a map is ^^
maps but more useful (https://discord.js.org/#/docs/collection/master/class/Collection).
and .mentions are literally collections.
they're not.
noop
sorry im so dumb but how do i make a music command lol
@ripe lantern if you're new to djs it'll be hard. Search up some tutorials.
Oh, my bad tho. Thought we meant mentions.users
You literally said .mentions are collections @nimble escarp
im using python 3.6
I know, it was a mistake in my brain 
.users is a collection
hello
i have a question i run my bot on server
for playing music i have a problem :
PyNaCl library needed in order to use voice
anyone can help me for fix problem?
const figlet = require("figlet");
console.log(figlet.textSync('test').red)```
Anyone know why this is undefined...?
Ok
@summer torrent can you help me?
i have a question i run my bot on server
for playing music i have a problem :
PyNaCl library needed in order to use voice
anyone can help me for fix problem?
is that python
I am using js. Sorry I can't help you
ah okay , anyway thanks 🙂
load pylancı library
how i should load?
pip install ?
pip should already be installed ...
wait pls i want check my codes
yeah
i installed
i use it for install
py -3 -m pip install -U discord.py[voice]
Moderation commands
oh i understand you
Can u help me?
yes
please
- dont code on mobile
- learn the language you want to use
- LEARN THE BASICS OF HOW BOTS WORK
code 'em
I code on mobile ._. and it works

With the app termux




