#development
1 messages · Page 628 of 1
is there a bot that monitors your uptime and displays it as a percentage?
It's voice.channel in master afaik @dusky marsh
https://discord.js.org/#/docs/main/master/class/GuildMember?scrollTo=voice
hm, my code for 11.4.2 works with <message>.member.voiceChannel so I assumed it wasnt changed, maybe it was tho ¯_(ツ)_/¯
hey
@rotund creek Monitors a user? aka you?
yeah
Em, This isn't the chat for asking that #memes-and-media but you could just code one.
someone told me to post here I didn't realise it was dev tho
so I just clicked on it and pasted
Can someone tell me how I select .json in discord.js and what can write in for example a user profile with birthday banner and favorite color and description ...?
use fs
its a npm package
I know
but how do I use it?
You have searched on google before asking here?
Yes
Did not find anything that worked for me
For select something in a json file ```
const json1 = require('../test.json')
json1[data].data
or
json1[data]
Ok
its very easy
But im to stupdit for it xD
One of the best ways to exchange information between applications written in different languages is to use the JSON (JavaScript Object Notation) format. Thanks to its uniformity and simplicity, JSON has almost completely replaced XML as the standard data exchange format in so...
Ok...
Thx
Np
anothermessage.react('🌲')
const filter = (reaction, user) => {
return ['🌲'].includes(reaction.emoji.name) && user.id === message.author.id;
};
anothermessage.awaitReactions(filter, { max: 1, time: 10000, errors: ['time'] })
.then(collected => {
const reaction = collected.first();
if (reaction.emoji.name === '🌲') {
if (db.get(`userInfo_${message.author.id}.bucheron`) < 10) {
drop = "Chêne"
}
reaction.remove()
arbrecut += 1
}
})
})```
Hi how i can remove the reaction of user and not bot :
reaction.remove() remove the reaction of the bot and not the reaction of the user :/
Its working? @lofty hamlet
Np
But this i can't reclick in the reaction
I think is it an awaitreaction
He work just one time
I want than the user can re click in the reaction
Oh ok and how i can make unlimited ?
Whats happening when you put 0 or 999
Remove max: 1,
Yeah
I go eat i come again if you have a response ping me plz
Thx
Np
Additional reactions won't do anything because const reaction = collected.first();
You're using the first one either way
Ah yeah
Code logic doesn't make much sense
If you'd want just the first, you should just use max: 1, no reason to have collected.first()
Your filter checks the emoji name and inside the event you check it again
You're using an array with just 1 element
@lofty hamlet ^
Also a possible issue why your second reaction wouldn't work is the time limit you've set.
Make sure you didn't pass it
I'm back
If the time are passed, you cant put an another reaction
No the time change nothing i say 😉
What's your current code
You want all of my code ?
arbrecut = 0
let embed = new Discord.RichEmbed()
.addField(`Amélioration métier de Bûcheron`, `Dernier arbre coupé : ${drop} (Bois de cet arbre obtenu)\nArbre(s) coupé(s) durant cette session : ${arbrecut}\nNiveau actuel du métier : ${db.get(`userInfo_${message.author.id}.bucheron`)}\nXP actuel du métier : ${db.get(`userInfo_${message.author.id}.bucheronxp`)}`)
.setColor("RANDOM")
message.channel.send(embed).then(anothermessage => {
anothermessage.react('🌲')
const filter = (reaction, user) => {
return ['🌲'].includes(reaction.emoji.name) && user.id === message.author.id;
};
anothermessage.awaitReactions(filter, { max: 1, time: 10000, errors: ['time'] })
.then(collected => {
const reaction = collected.first();
if (reaction.emoji.name === '🌲') {
if (db.get(`userInfo_${message.author.id}.bucheron`) < 10) {
drop = "Chêne"
}
reaction.remove(message.author.id)
arbrecut += 1
}
})
})```
And what are you trying to achieve
@lofty hamlet random color working?
@earnest phoenix of course
@late hill i want when i click in the reaction, the reaction is withdrawn and i can reclick for make the same loop
Should still change your filter to
reaction.emoji.name === '🌲' && user.id === message.author.id as mentioned before
No reason to use an array
Yup
const filter = (reaction, user) => { return reaction.emoji.name === '🌲' && user.id === message.author.id }; so i test this
The issue you're having however is that max is still set to 1
The collector ends after the first reaction that passes the filter
Nothing change
Yes
So ?
Because your next issue is collected.first()
How i can make this 🤔
The second won't be the first
How do I clean hashmap in js?
@earnest phoenix not work and i can't remove .first because i need
So nobody can help me? 😦 ?
I don't use discord.js but I feel like message.awaitReactions().then() would wait till your collector is finished
Map.clear() 
You probably wanna use message.createReactionCollector() instead
const collector = anothermessage.createReactionCollector(filter, options)
collector.on("collect", reaction => {
//Code to execute everytime a reaction passed the filter
})```
@lofty hamlet pong
filter and options are the same as for awaiting the reactions
try yourself, its not hard
It will not only be on this message though? If several people make this order at the same time ...
- You create a reactionCollector on the message
- You pass a filter to it, to make sure you only get the reactions you want
- Pass some options to limit the time, amount of reactions, ..
- You put a listener on the collector that fires for every reaction it collects
You're calling createReactionCollector() on a message
Which means it'll only be for that message
reaction is just one reaction
"Not work" oh boy
Ok
And remove the additional emoji name check as you already check in the filter..
Oh my bad
But does not work
What doesn't work
collector.on('collect', (reaction, reactionCollector) => { reaction.remove(message.author.id) arbrecut += 1 })
This
The reaction is not removed
reaction.remove() doesn't take args
🤔
Which means you just put reaction.remove()
But reaction.remove() the same does not work
oh
So i have this
You can optionally put a user id
I apologize if this has been answered, or if I could be directed to the answer, but my bot has NOT been posting LIVE NOW notifications in my channel. How can I fix?
You're probably talking about a specific bot you added to your server
This isn't a support server for that
And did you react to the message
Yes i react ahah i'm not stupid >-<
🛴
Hu ?
Not anothermessage
Oh ok
😂
uhh
I have actually this
Return if the author of the reaction is the bot
The filter should stop that 👀
...
What ? lmao
Yup
You say change this
Not the entire thing 😂
You should keep them as 2 different names
Preferably a name that actually gives information on what it is
Suggestion, name your bot's reply reply
Ok i have patch this
So
Ok thx i go continue my command 😉
If i have problem i contact you 😉

dbl dealer
icup
Promoting bad
Ick, particle.js
this is
so
stupid
i cant understand it
why doesnt it work
it dumps the info to some galaxy far far away and not its source directory
i need help
All I can think is instead of just doing the .json file, just use the actual link to the path you want to dump it to.
is java?
No
That's python
So specify a specific path instead, maybe? @topaz sphinx
Honestly that's all I can think of
"userbookmarks.json" tries to save it to
2 things happens
first if i just keep it as it is
it just saves it in the home directory of the server
however
if i aim towards that thing
does a presence update cache a user? in d.js
"Memory error"
The maximum length of JSON strings. The default is 2097152 characters, which is equivalent to 4 MB of Unicode string data.
I would doubt he's reaching that limit
But there is also no inherent size limitation to the JSON request. Any limitation would be set by the server parsing the request.
@topaz sphinx
All I can think about is changing how you write by going from that to
datastore.write(json.dump(dump_stuff))
(I believe that's the syntax?)
I think it does the same thing essentially but just check if it changes what happens
what
Your code should work so 
json.dump isnt same as json.dumps
You're using json.dump
which works normally
I'm gonna stop trying to help because I've no clue how to fix it
but not here
Back to memes. Good luck.
Do what
nope, gave error 
fuck
ye probs something to do with bad memory error, goddamn pythons
yes thats why i had intentions to ping u 
yes <<<
does anyone know how to use await
presence
for discord.py
await bot.change_presence(activity=discord.Game(name="a game"))
something like this
No
@client.event
async der on_ready():
await bot.change_presence(...)
one sec
ok
game= is activity=
game() is discord.Game(name="")
ok
@client.event
async def on_ready():
activity = discord.Game(name="activity")
await client.change_presence(status=discord.Status.online, activity=activity)```
@storm oak
next time, read the docs
yeah
can anyone help me for an anti raid command that edits a role?
if (msg === prefix + "daily" | msg === mention + "daily" | msg === mention1 + "daily") {
return dbl.hasvoted(sender.id).then(voted => {
if (voted) {
console.log (sender.username + "has voted!");
message.delete().catch(O_o=>{});
message.channel.send({embed: {
color: 0x00bdf2,
title: "Thanks for voting!",
description:(`This command is still under testing, and no rewards are currently available. However, thanks for your help!`),
footer: {
icon_url: bot.user.avatarURL,
text: "MusEmbed™ | Affiliated with Paraborg Discord Bots"
}
}});
} else {
message.delete().catch(O_o=>{});
message.channel.send({embed: {
color: 0x00bdf2,
title: "You haven't voted for us yet!",
description:(`Vote [here](https://vote.musembed.tk/) and do this command again to claim your voting reward.`),
footer: {
icon_url: bot.user.avatarURL,
text: "MusEmbed™ | Affiliated with Paraborg Discord Bots"
}
}});
}});
}
anyone sure what's wrong with that lol
(node:3687) 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: 2)
basically spits out this
oh BTW sender is defined
as message.author
I suck at async things


java
.js
F
Question: Currently in the process of developing a web dashboard but was considering migrating from SQLite to an alternative DB while I'm at it. What do people feel is the best option / what do you use? (MySQL, PostgreSQL, MongoDB, SQLite, etc.)
@clever radish from sqlite your gonna want something like mysql
@earnest phoenix mongo is nosql so moving from an sql based system to a nosql based system isnt exactly clean carry over
if you want nosql though redis is proven to be around 3-4x faster than mongo
mongo really starts to slow down on scale
oh seriously?
Ah, sorry bout; nah, have a fair amount of data unfortunately that would need to be migrated over
@clever radish yeah so mysql is probably the way to go
Hmm, would maria be a good choice then? (over just standard mysql)
o:
left axis is solid line scale
right axis is the dotty line scale
is it sql or no sql?
believe it's just a fork of mysql (supposedly more feature-rich)
oml way to be a special child it supports both
it is a fork
as of maria v10 is supports both nosql and sql mode
oh, ffs lol XD
which is uh unusual
ive never seen that in a db
reading an "unbias" article Why Switch to MariaDB?
excuse me where is the Why Switch to MySql? header
but yeah mysql is pretty much no code change needed to move from sqlite
other than updating the sql calls functions the rest is the same all queries carry over
@clever radish depending on size that might help not having to update the queries
Ok, cool! Appreciate the help, was leaning towards mysql / Maria anyway, so was nice to get some extra opinions 😄
Danny didnt like when I told him Mongo would need a nice big rewrite 😄
sorry not familiar with maria but for ease a sql based db will help
yeah sql to nosql transition isnt fun
Doesn't Discord use Mongo? I can't remember if they went from Mongo to Postgres or the other way around.
think they moved recently from one of them yeah
They use cassandra now
assuming thats nosql?
yes
I got an error because a message with type 8
But discord's documentation only shows up to 7
tf is 8 ??
Is it the server boost messages maybe?
Ask to @solid gale
@earnest phoenix
or join mee6's support server and ask to admin. NO MODS ONLY ADMIN
What I do help me
First of all reset that bot token
Second of all what even is this
Third of all ARE YOU TRYING TO RUN THE "BOT" ON YOUR PHONE???
oml
its not even a legit token
Oh
Tell me what I do first
read discord.py docs
Do you know Python?
@spring ember yes
Let's hope so
bot token ("") is not valid syntax
Was it literally that
I recommend learning python a little deeper before starting to develop a bot
@slender thistle yes
Oh man
print("hello , python !!")
bot token ("insert malformed token here")
thats what the code was
Yes
Oh
opens hello world tutorial
I fully know Python now
I honestly wanted to blame it on the docs but after seeing that... I realized I was wrong
hmm
string === "Return to the line"
the fuck thats literally how you do it
Which way is best to host a bot android?
you cant and dont
@mossy vine what
@mossy vine line break wtf
a new line?
@mossy vine why
In middle of this text
In middle of this text
just... do us all a favour and dont host a bot on android yeah?
so you want to check for an empty line, or if a new line starts?
@modern sable unmentionable name here
split the string at \n, loop through the lines and check if its empty
@mossy vine why I don't host a bot android
@modest remnant you cant
@mossy vine why
@mossy vine 🤔
do i really have to write an essay on why you cant host bots on a phone
you probably need a rooted android to host on it
there are probably shady ways to do it without root, but its very complicated and will probably overheat your phone and will probably lag a lot
the solution is, buy a pc
Pc?
Computer 
Anyone make a bot for me
Not
@modest remnant ask Oliy#0330 for permissions to post in #434058442764714002
how can i do something like with javascript
If time = 07:00 then
sendmessage
use moment
or if(Date.now() === 'Unix Timestamp')
Unix timestamp is 1559653024
i need time function
for example
If time == 07:00 then
send "goodmorning!" to #loby
yup use moment
or wair
if(currentdate === 'date') {
message.channel.send('Good morning')
how can i write time to date
can you write an example code here?
if time = 7 then send hello
var currentdate = new Date();
setInterval(function()
{ if(currentdate.getMinutes() == currentdate.getHours()) {
message.channel.send('Good morning')
} }, 1000 * 60)```
i cant send u the exact code, i just give you a example
For the interval, I believe
1000 * 60 = 07:00 am?
Wwdc is best thing
also wouldn't you need to assign the var in a loop so it constantly changes
how it can check 07:00 am?
const client = new Discord.Client();
client.on('message', message => {
//...
});
client.on('ready', () => {
setTimeout(function(){ // in leftToEight() milliseconds run this:
sendMessage(); // send the message once
var dayMillseconds = 1000 * 60 * 60 * 24;
setInterval(function(){ // repeat this every 24 hours
sendMessage();
}, dayMillseconds)
}, leftToEight())
})
function leftToEight(){
var d = new Date();
return (-d + d.setHours(8,0,0,0));
}
function sendMessage(){
var guild = client.guilds.get('guildid');
if(guild && guild.channels.get('channelid')){
guild.channels.get('channelid').send("Good Morning");
}
}
client.login("token");```
@restive light
@fossil oxide
why did you tag oliy
ping pong
Its sending every day at 8 hours "Good Morning"
"8" is time, anothers are seconds / milliseconds or something like that?
setHours
yup
oof
thanks for helping man
i dont do js
np
Google Channel helps another soul not have to look at the docs.
thats complicated
Like how much
No very easy @restive light
its not easy to do what you need
To make things a little easier, an object literal syntax is also supported, like in this example which will log a message every Sunday at 2:30pm:
var j = schedule.scheduleJob({hour: 14, minute: 30, dayOfWeek: 0}, function(){
console.log('Time for tea!');
});
Example from the package
you have to:
when bot starts, check how much time left for the next 7am
create a setTimeout function with that much delay;
when sending, create another setTimeout for 24 hours later
or a setInterval that is triggered by a setTimeout once after the bot is up?
also possible yes
i thought something like
string time = system.time
if time = ("07:00")
send hello
yes, but it doesnt work like that
because the system doesnt tell you what time is it. your bot has to ask the system
so your bot has to ask the system every minute to check what time it is
or you just do the math to find how long until the next 7am
wait are you using java or javascript
its much better to do the math than to ask every minute
js
all languages are like that, its not javascript's fault
scheduled tasks > checking x every y seconds
the only hard part is finding out when the next 7am happens, and its also not that hard
grab the current utc time and do the math
let now = new Date(); // what time is it right now
let hour = now.getHours(); // what hour it is right now;
let day = now.getDate(); //what day it is right now;
if(hour >= 7) { // if hour is bigger or equal to 7, meaning 7m already passed today
day = day + 1; // set day for tomorrow
}
let next7am = new Date(now.getFullYear(),now.getMonth(),day,7);
let howLongUntilThen = next7am - now;
(untested)
Hi how i can verify if my string content line wrap ?
wat
i literally told you wtf
Oh ok thx
And i have a problem
let foundInText = false
for (var i = 0; i < unblacklisted.length; i++) {
if (collected.first().content.includes(unblacklisted[i])) {
foundInText = true
}
}
if (!foundInText == true) return message.channel.send(`Vous avez utilisé un caractère interdit. Voici les caractères autorisés (Veuillez retaper la commande pour vous enregistrer) : **${unblacklisted}**`.replace(/,/g, " "))```
This is my system for accord letters for my string
what
what
However it does not work because if it contains a letter granted even with letters not granted it passes
@lofty hamlet you know you can restrict number by if(isNaN(args[0]))
Ohhh
then what im not using it xD
Update your discord.py
Don't subclass commands.Cog if you don't wanna update
No, it's not. Latest version doesn't give that error
Compare your d.py version with pip show discord.py
Like honestly why don't you just update your d.py
Save headache for both of us
have to rewrite the whole bot then
Are you using 0.16.12?
yeah
Latest dblpy doesn't support any version below 1.0.0
As all d.py versions other than 1.1.1+ are discontinued, dblpy decided to drop support for those versions too
lol
Someone know how to do a countdown in js ? Like 24 days 5 hours and 51 minutes left until release
you can subtract dates
let foundInText = false
for (var i = 0; i < unblacklisted.length; i++) {
if (collected.first().content.includes(unblacklisted[i])) {
foundInText = true
}
}
if (!foundInText == true) return message.channel.send(`Vous avez utilisé un caractère interdit. Voici les caractères autorisés (Veuillez retaper la commande pour vous enregistrer) : **${unblacklisted}**`.replace(/,/g, " "))```
However it does not work because if it contains a letter granted even with letters not granted it passes
because the loop logic is completely wrong
Yeah but substract date just returning the number of days
and time
And how i can return if the string content line break ?
also what the fuck !foundInText == true oml
@mossy vine all work except the flaw that I said
you don't need == true
just use regex instead of a huge unreadable array
That's not the problem
it is
you are looping through the array
and thats just fucking stupid
and is also whats causing your error
I don't know regex
also im 90% sure that if (!foundInText == true) return isnt doing what you want it to
you are literally using regex in that code
No, if (!foundInText == true) return
Works
The problem is :
When i use unblacklist letter with blacklist letter it passes
yes
because youre using an array and the loop logic is completely wrong
it makes no sense at all
Just check for higher level characters instead of storing valid ones in an array
use regex
^
I don't jnow regex what is this ?
javascript includes regex by default, use can use it like this for example: string.replace(/regex here/options,replace with)
what exactly do you want to do?
I want maje a granted letter and all of the other caracters is blacklist
let = unblacklisted = ["a", "z", "e", "r", "t", "y", "u", "i", "o", "p", "q", "s", "d", "f", "g", "h", "j", "k", "l", "m", "w", "x", "c", "v", "b", "n", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "_", "'", "é", "è", "à", "ç", " ", "\n"]
Is my granted letter
so if people type any letter that is not in that list, they get an error?
Yes
why do you have "register" if you have the individual letters?
how to export something from a setInterval(function... ?
what about capitals @lofty hamlet ?
@quartz kindle i add this after
So don't need
tolowercase
I use
Just my system work but i have a fault
string.match(/[^a-z0-9\s-_'éèàç]/g)
?
var x = setInterval(function() {
var now = new Date().getTime();
var distance = countDownDate - now;
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
const embed = new Discord.RichEmbed()
.setColor('#00ff00')
.setTitle("Frontshot.io | Release")
.setDescription(`Released in **${days}** days, **${hours}** hours, **${minutes}** minutes, **${seconds}** seconds.`)
.addField("Release Date", "25/07/2019")
.setFooter("Frontshot.io")
if (distance < 0) {
clearInterval(x);
embed.setDescription('Countdown Finished')
}
}, 1000);
message.channel.send(embed)``` error: embed not defined
if a person types normal text, the function returns null
if the person uses blacklisted characters, the function returns an array of the bad characters they used
so just check it. if it returns null, pass, if it returns an array, dont pass
if someone know how to resolve this without adding "message.channel.send" in the interval
if (!collected.first().content.match(/[^a-z0-9\s-_'éèàç]/g)) return message.channel.send(`Vous avez utilisé un caractère interdit. Voici les caractères autorisés (Veuillez retaper la commande pour vous enregistrer) : **${unblacklisted}**`.replace(/,/g, " "))``` @quartz kindle
If i have understand
But does not work
you do not need the blacklist at all
sorry, unblacklist
also wtf let = unblacklsited = []
what
oh no its good,
I just needed to clear the interval
it works
@lofty hamlet i highly reccommend the site https://regex101.com/
Regex101 allows you to create, debug, test and have your expressions explained for PHP, PCRE, Python, Golang and JavaScript. The website also features a community where you can share useful expressions.
@earnest phoenix dont do that
you're trying to send a message every second
thats too much
do something like 5 seconds at least
and you can use message.edit instead of new messages every time
var countDownDate = new Date("July 25, 2019 00:00:00").getTime();
var x = setInterval(function() {
var now = new Date().getTime();
var distance = countDownDate - now;
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
const embed = new Discord.RichEmbed()
.setColor('#00ff00')
.setTitle("Frontshot.io | Release")
.setDescription(`Released in **${days}** days, **${hours}** hours, **${minutes}** minutes, **${seconds}** seconds.`)
.addField("Release Date", "25/07/2019")
.setFooter("Frontshot.io")
if (distance < 0) {
clearInterval(x);
embed.setDescription('Countdown Finished')
}
message.channel.send(embed).then(e => {
clearInterval(x)
})
}, 1000);```
its not good ?
Exemple @quartz kindle my string : BNeb!ea
and if (!collected.first().content.match(/[^a-z0-9\s-_'éèàç]/g)) return message.channel.send(`Vous avez utilisé un caractère interdit. Voici les caractères autorisés (Veuillez retaper la commande pour vous enregistrer) : **${unblacklisted}**`.replace(/,/g, " ")) does not work
It's very strange that it shows me the message quan I use only tiny letters
@lofty hamlet what is not working?
The system
remove the ! at the beginning
Yes it's good i test
I can juste enter the tiny letters (lowercase)
@quartz kindle
No
what doesnt work?
I can juste enter a string with lowercase
you said no capitals
^ also that
you said you do .toLowerCase
?
Yes fail wait
It's work thx u !
So \n is not blacklist ok
I go read your response xyber
Question about best practices:
My bot has multiple modules so I want to allow special prefixes for certain modules.
Example:
My bot has > as a default prefix.
All commands in to "osu" module start with osu! (e.g. osu!stats).
Currently users need to type >osu!stats.
Would it be considered good or bad practice to also allow osu!stats on its own, if osu! is considered a prefix for that module?
having per-module prefixes wouldnt be considered good practice, since it increases the chances of overlapping prefixes with another bot
you could add some sort of prefix modifier like tatsumaki does, t! and t@
Ok, I'll leave out the module prefixes and use custom aliases (programmable triggers) then
Actually, is there a list of best practises somewhere on this server? Like a checklist of things to consider for bot validation?
there is a list of general bot best practices
yup :)
with node-ipc is it possible to send back a response?
pretty sure it is
@earnest phoenix we don't use a lib. It's all custom code.
a
does anyone know how to get the guild id on memeber join/leave with discord.js?
member.guild.id
oh aight thx
def is_nsfw():
session=aiohttp.ClientSession()
nsfwheaders= 'token'
cstats= session.get(url="https://discordapp.com/api/channels/"+str(message.channel),headers=nsfwheaders)
print(cstats)
return cstats
I'm trying to homemake a is_nsfw variable in async
I'm not really getting a error
But it wont show "true" or "false" or even anything other than a <generator object at 0x00000000000> or sth
cstats returned a coroutine
You need to await it, which you can't do outside of async functions
It's in the async function on_message
then await session.get
Your is_nsfw function is not an async one
It is
I think neko is trying to make one
Send me your whole code
K
async def is_nsfw():
#data= (discord.http.HTTPClient.request(
#self="_locks",route= '/api/channels/'+message.channel.id+"/nsfw"))
#channeldata = [d for d in data if d['id'] == message.channel.id][0]
session=aiohttp.ClientSession()
nsfwheaders= token
cstats= session.get(url="https://discordapp.com/api/channels/"+str(message.channel),headers=nsfwheaders)
print(cstats)
nsfw="nsfw"
return str(cstats)
#channel is safe to run nsfw content
Why all that
Are you still using 0.16.12 or is it 1.0.0+
0.16.12
Ah, okay then, I get it now
?
Hello
It needs to be await session.get because that will return a coroutine
Then, cstats will have an attribute, .json, which will be a method you have to await too
Ok
const Discord = require('discord.js')
module.exports.run = (bot, message, args, prefix) => {
let membre = message.guild.roles.get('585256713557377026')
membre.edit({
data: {
SEND_MESSAGES : false
},
reason: 'Hex Bot'
}).catch(error => client.catch(error))
};
module.exports.help = {
name: "raidon"
};```
TypeError: Cannot read property 'id' of null
I cant find id here @wicked pivot
how do I do?
the error is not from that code, its from somewhere else
AWS is easier to upload to depending on the lang
Also a website hoster
@static matrix AWS s3 for storage.
AWS route 53 for web hosting
Has anything changed with the client.fetchUser() method?
i'm actually stuck, why cant i access class error css
alright
i can access it by using h1.error in the html using <style>
but i cant access it trough a css
what the fuck?
use inspect element to verify that the css file is actually loaded
in chrome just go to the Sources tab
Why do u have a <header> tag outside body?
header is for the top bar
or
im not sure im too stupid to use html, but i gotta learn it
i do have it right there
it didnt update
what
alright
some issue with it
i cant even understand
to begin
@opaque eagle tbh i am bad at html
but
apparently it ignores my thing
it doesnt exist in the chrome
Why don't u just say index.css instead of the {{}} stuff?
whats your environment? where are you developing?
local files and opening with browser?
Visual Studio Code
its completly dead
but im trying to change Gofven's thingy
from black to red
^
go into anonymous/incognito mode to make sure it isn't your cache or do that
F12
^
wait where u disable cache
In the "Network" tab after you press F12
As long as the developer tools are open, it will force refresh your page every time
FINALLY 
I would like to split a string every ":" EXCEPT if this ":" is just after "http" or "https".. Do you know how to do it?
I'm using Java so regex could do the trick?
/(?<!(http|https)):/g
Can python bots detect if you boost a server?
ayyyy web socket connection closed with no reason killl meeee
help
when trying to get data.selftext from reddit's JSON it returns null
but when viewing it in the browser, it actually shows text (same post)
data.title and data.url work fine
wait i'm dumb nevermind, fixed it
need some quick help
text container at bottom, i tried multiple ways to move it upwards, but with no luck
i want it to be movable relative to the "botInfoContainer"
i mean botInfoContainer2 have relative position, doesnt it mean if i do botInfoDescritpions movement absolute, it should move?
anb
fs.appendFileSync(`C:/Users/TreverGserv.1033/Desktop/APlus/Storages/${user}.txt`, (modlog), {"flags": "a"}), (err) => { if (err) console.log(err); };
I'm using this code but fs wont make the file if it doesn't exist
The documentation says it should make it
how would you check if a user has voted in the last 12 hours?
webhook
Ahh all that info is in DiscordBots.org api I believe
Hey all. Another "best practice" question:
I programmed by bot to fall back to DMs in case a valid command is executed, but the response could not be posted in the same channel.
Is falling back to DMs ok in this scenario?
And a more technical question about shards:
From what I read, I understood that private channel message are only received on shard 0. Is this correct even if shard x sends a DM? Would a user response still go to shard 0?
anything dm is put onto shard 0
shard 0 sending back to a dm as far as its concerned its just another channel
you dont need anything special to allow your bot to reply to a dm if its sharding or not
any shard is allowed to send to a dm
but all user messages go to shard 0
any shard can send to any channel your bot is in btw (even if its not that shard controlling that server)
only receive events are handled per shard and voice
does that help? @warm sail
It's more the other way around. Here's my current scenario:
- A user sends valid command with ambiguous input for which user should be affected, for example.
- For whatever reason the bot cannot reply in that channel, so it falls back to DM (let's assume we're on shard 2)
- The user clarifies the input via DM
I'm guessing that DM would go to shard 0 and not shard 2, by what you said.
thats right yeah
😦 ok, I need to rewrite a bunch of my fall-back routines then
shard 2 is allowed to send the message and also the reactions
but shard 0 will be receiving the users response
important to note any command that needs context your going to need to tell shard 0 about it
Yeah, I want my shards to be independent of each other, so I need to assume that a user cannot "answer" via DM if it's not shard 0.
if the command you made the user give in dm is enough to tell shard 0 how to respond then thats good enough
Yeah, I'll still send responses, but they will terminate the command instead of waiting for additional input.
If DMs are involved, that is.
tbh if your bot doesnt have send permission there is probably a reason for it and the user wont want a dm for it
thats my experience at least
hence my "best practice" question
like locking bots to channels cause x bot wont let you change the prefix so you try isolate it
you wouldnt want a dm from it every time you use the other bot
unless its an uber important thing i wouldnt send dm as a fallback
ok, thx for the help and advice. I nees to think about how I want to solve this
if your just starting then sharding is a long way off so dont worry bout it
think in my bot only time i dm someone is when they send the help command
or when they claim an api token cause those probably shouldnt be public lol
yeh dms when a bot isn't able to reply could be annoying
but "tbh if your bot doesnt have send permission there is probably a reason for it and the user wont want a dm for it" isn't always true
It happens a lot that ppl complain about a bot not working simply because they forgot to give it send-messages end-usertm
yes thats painful lol
Basically both scenarios aren't great
But doing the DM requires some extra code so- skip
😂
I forgot to mention that I check channel perms before executing a command.
So I would only DM if a command was executed but perms went missing in the mean time. Otherwise the command wouldn't have been executed at all.
i just send and hope for the best 
Hi
Hello bot developers i need your help to deveload a good bot for my server+ for this server too
i need your help to deveload this bot and i am very new to this bot develoaping pogram, and it is kinda hard for me{ cuz i only know html programming plz i need your help and i gess that every 1 in this server will help me
thank you
from=Pgoldy
He's completely new ig
yea
Cause he said he only knows html
im trying to learn this programming
Which lang are you triying to learn ?
You should google a tutorial
yes
epic
y?
const { Client, RichEmbed } = require('discord.js');
const client = new Client();
const usedCommandRecently = new Client();
client.on('message', message => {
var prefix = "!" ;
let args = message.content.substring(prefix.length).split(" ");
switch (args[0]) {
case 'cooLdown' :
if(usedCommandRecently.has(message.author.id)){
message.reply("You Cannot use this command now! wait nother 30 secound");
} else{
message.reply('You are not in the wait time! this is RangerZero Command');
usedCommandRecently.add(message.author.id);
setTimeout(() => {
usedCommandRecently.delet(message.author.id)
}, 30000);
}
break;
}
});
this is my codes why when i run the bot he say that "usedCommandRecently.has" not a function
i cant understand
^^
Because .has doesn't exist maybe
how ?
delet?
@lofty bane ik
@vague chasm ?
change const usedCommandRecently = new Client()
to let discord = require('discord.js') const usedCommandRecently = new discord.Collection()
I am 80% sure you have to use a collection
@lofty bane
Or consistency and add Collection to the stuff you already import
ok
redstone
^
Might be a good idea to get a spellings checker
yes magic0?
it worked but new error was appeard
what is it?
usedCommandRecently.add is not a function
Yeh
oh it worked ❤
@vague chasm
ok
👀
do someone have an idea about this problem?
Oh man
And what is your problem?
nvm
Import time, use ctx.send instead of using send_message
ctx.send in a function that doesn't have ctx
Hmm...
@earnest phoenix IDs are now int since you upgraded your discord.py
I suggest using f-strings if you are on Python 3.6+ or otherwise .format

l o a d i n g . . .


stop

Showing err at ctx.font = applyText(canvas, `${member.displayName}!`);
Err = 'applyText' is not define

How many lines of words can I have in an embed field value?
You can have 1024 characters ig
@pallid zinc read the error
No @wraith cipher
356 characters @earnest phoenix
or something like that
In description you can have 1024
It not that
256 probably
Yep
@pallid zinc use canvas-constructor is easy
I use canvas
Okay
canvas-constructor is better than canvas
Canvas constructor works as an embed
like .addText('').. Image.. Ext
Sound easy
Yeah its very easy
You can change text font or text color by
.setTextColor(), .setTextFont()
i started using glitch
everything is fine
but it doesnt write to json
yup
i updates it when it starts
i think you cant
but while its working i may not write anything on it
it worked once
i changed a value and it changed in file at the same time
@earnest phoenix thanks for help sorry I forget to say before
No but you need to wake it up
Use uptime robot
But you have to refresh it after you add some new commands @earnest phoenix
It doesn't matter though, in the end it will be offline
You have a limit of hours per month on glitch
@pallid zinc n0
Np
Is there a way to sort JSON files values so it will compare to each other and sort in a descending format?
Language?
js


