#development
1 messages · Page 750 of 1
pretty sure you can
idk
but how do you get the embed content from a message
message.embeds returns object object soo
and message.embeds[0]
returns nothing
One message removed from a suspended account.
One message removed from a suspended account.
what is your shoukaku version
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
how to install Python 3 on glitch.com? Any console commands?
iirc its installed by default
pip3 install -U discord.py?
won't work either
i dont think you can do anything then
i dont know if glitch allows you to install stuff, but just in case, run it with sudo
sudo install discord.py?
sudo pip3 install -U discord.py
kk
Just fyi D.py requires 3.5.5 or newer
Also wouldn't recommend either glitch of heroku
Wasn't it 3.5.3
I thought it was 3.5.3 after the aiohttp update
@fluid basin yes i know, but stable d.js better than d.js-commando
master is a lot better from what ive seen and heard
It is way better than stable
how to run multiple scripts at the same time
@earnest phoenix what you mean
how to make command handlers in py
js
no i mean from additions like kick.js or ban.js
like those

You use a command handler for that
^
@vital lark d.js allocation is huge ngl for sable and master

@earnest phoenix why you ask?
dont pull no funny business jade, hes onto you 
Fug
never seen so much typos im one simple sentence
One message removed from a suspended account.

One message removed from a suspended account.
Welcome to rain on your screen
One message removed from a suspended account.
LMAO
One message removed from a suspended account.
You end up hitting q when you try type m
One message removed from a suspended account.
Cuz that's how fucking water works on the screen
water sucks
it doesnt but this is #development not #memes-and-media
i once died cause of water.
One message removed from a suspended account.
d.js memory allocation small to jda
but still its smaller, cause 100 server d.js bot uses ~ 70mb ram and JDA ~ 100 mb
how to snipe (make snipe command)
mmm
you basically make a message delete event and save it in a cache pool and get it from there
wdym it's broken
I'm not editing a single file since 3 hours
but if its still open in background
hi since i couldn't solve that sql backup for that JSON i use and save the prefix and log channel and my question is can emg be done somehow to set the language on the bot
because I want a community bot that can be used in multiple languages
pl -lang hun or eng or russian etc.....
if somebody knows how to solve it or how to save other languages, i would do it
lang hun 
but you could just save the chosen language in your db as you do with other data
but how do i tell her that tongue is dutch and that she writes it in her native language etc ...
how can I see how many times has an command been executed in d.js?
I have to code something myself?
yes just have a counter or somthing
oh:(
oh no imagine incrementing an int 😢
well, the solution is actually surprinsingly simple
all we have to do is not incrementing a int
i mean it is just counting
what can happend to this little kounter
welcome to america
😦
command counting is pretty simple
have a database that has two fields, command name and usage count
or collection/table depending on db type
if(!mutedRole) continue;
if(Date.now() > time) {
console.log(`${i} is now able to be unmuted!`);
member.removeRole(mutedRole);
delete bot.mutes[i];```
Even though its what should be used?
its not I looked it up
member.removeRole(role).catch(console.error);```
thats whats on the web
What did you define member as?
either member or .removeRole is undefineed
let member = guild.members.get(i);
believe its in error in my mutes.json because nobody is currently muted
which makes sense why it would fail because there is no role to take from anyone
Maybe, is i an item from the json list?
nevermind
its not an error in the mutes file
i is the ID it logs in the console when someone is unmuted
not sure what it is
for(let i in bot.mutes) {
let time = bot.mutes[i].time;
let guildId = bot.mutes[i].guild;
let guild = bot.guilds.get(guildId);
let member = guild.members.get(i);
let mutedRole = guild.roles.find(r => r.name === "Custom Ban");
if(!mutedRole) continue;```
Not the full code
@modest maple tried what you said with caps, doesnt work
remove role is defined through const Discord = require("discord.js");
Is mutes a list of ID's?
bot.mutes?
Yes
I'm using liveshare to code from my pc to the vps
that's the only inaccessible file since it doesn't save
Can you show me exact what mutes is?
incorrect capitalization, it's supposed to be removeRole
I think you just need to destructor it assuming it's a map.
and yeah, it probably didn't find a member from the guild
I had the correct cap I was checking it earlier
because there was no member found
I believe the problem is that the user that is mentioned doesnt have the role
for(const [key, obj] of bot.mutes) {/* code */}``` is how I'd do it.
key being the id presummably.
I fixed it
I went to the vps and emptied mutes.json
the user was already unmuted
so he didnt have the role anymore
but it thought he still did
consider moving to a proper database btw
^
JSON files aren't the way to go.
Consider MySQL or Sqlite
For small/medium bots.
Define small/medium
Like, less than 2k servers?
^
and if you don't want to learn SQL you can use ORMs such as Keyv and Sequelize
im less than 2k servers but 116k members would I be fine?
Yeah
Ok ill look into it
Seeing this server is about 76k of those members lol
And I doubt this server is using your bot. :^)
its not in this server
Oh?
this is a seperate bot im working on
ok
I also doubt all 116k members will be getting muted etc.
Along with what other commands it has.
True
Consider MySQL or Sqlite
avoid mysql, oracle 🤢
if you're going big scale, use postgres instead of mysql
Postgres is good.
time to learn how to setup a database
is there a better way to phrase this description? I'm not good at mouth speaks
it says 'shakes a magic 8 ball. You can use it inside conversations'
How is that related to development tho
I'd check the prefix in your command handler instead of hard coding it into the command's name
what makes that better?
if you wanted to change the prefix in the future, you can just change it in that one spot instead of changing it in every command
yeah, that's smart
plus, it enables you to add a custom prefix feature in the future if you'd like
how would i get a reload command to work with multiple folders Ex: ./user./userinfo.js
Hey guys, I want to try making a discord bot for my server, Ive done some javascript and have the basics up and running.
Have a question about some code though! What I want the bot to do is that it read user input in a channel lets call it "numbers". Then users in discord type their number in the channel and I want the bot to add the amount of users with the same numbers.
Ehm
Example, 5 people enter 2, 3 people enter 8 and 13 people enter 19
The bot should then type out how many people were in each instead of me manually counting how many in each.
A bonus would be for the bot to send 1 message per number and tell how many of each role have the number.
Example,
#2: 5 people, 1 Swede, 3 Danes, 1 Norse
8: 3 people, 3 Swedes
19: 13 people, 4 Danes, 7 Danes, 2 Norse
well
you can get the message
then detect if it startsWith a number
then get the number
then add a digit to an array
then get the .size
then .send the number
thats how I would do it
im not completely sure that will workt ho lol
alright ill try that 🙂
ok
I have a doubt, I am creating a mute command, and if the mute time is specified a timeout is created, but I have another unmute command, but it is in another js file, is it possible to stop the timeout of the other js file?
@empty owl I hadn't thought about that xD
you technically can, but it's more work than just letting it time out itself (e.g. save a list of timeouts then remove if unmuted)
can you make a bot stay in a voice channel 24/7
Yes, but the bot needs to be online 24/7, eg. if you using heroku/glitch there WILL come some downtime cause high usage of the services.
and sometimes glitch will uninstall a random module
if you don't ping it every 4 minutes
.
For glitch.com users
If you use glitch to "host" your discord bot, there is a way to keep the glitch project alive! Just install express-glitch-keepalive! If you want to keep your bot online 24/7, I recommend this extension. Instructions can be found at https://github.com/bpedro/express-glitch-keepalive
Well, with this extension it does
The fuck is glitch
Stability? Maybe. 24h "hosting"? Yes
Glitch is a little bit stable than discord API servers
cheap, stable, secure. pick 2.
Cheap yes
glitch comes under cheap and secure, imho
it isnt stable, it has the 12 hour timeout and apart from that it has more outage than a dioreahh patient.
ive been here just over 2 months and iirc there have already been a ton of quite major glitch outages
i notice when there are some because a lot of the 'lesser' bot lists go down, as thats where theyre hosted
@glad charm a "IDE"
i want a phpmyadmin system where i save data eg prefix, xp, lvl, log channel etc ...
how can i solve it because i get to the connection part but i have to rewrite file and get it out of the table i am not really translating right now it is looking at data from a json file it works fine only if there is sql then i can handle it from web page ?
question:
I am having my bot react with random emojis from the client.emojis datastore, with:
var emojis = bot.emojis.map(emoji => emoji.id);
message.react(bot.emojis.find(emoji => emoji.id === emojis[getRandomInt(emojis.length)]));
However, sometimes it throws this error:
Any idea what might be causing this?
and what I can do to prevent it?
Sometimes throws this error as in sometimes it works fine and reacts and other times it breaks with this error
and what are the problems?
/home/runner/index.js:106
return message.channel.send({
^^^^^^
SyntaxError: Illegal return statement
not sure because large amount of code
But I think you might have closed the listener above that
Meaning your return statement is just "flying" there
So how do I fix it?
Well
If that is the issue
By not closing the listener yet?
yeh
That is indeed the issue
You're closing the listener on line 100
Ok
There's also an issue in your blacklist array
at the end
"id, id" instead of "id", "id"
Also
You probably wanna go ahead and put the blacklist stuff above the commands
As the point of the blacklist is that they wouldn't be able to use commands..
i want to make a welcome message on this oylat that you can change and i went to json i have such a problem that i could do it to insert guild.name in json
that's not good, though
and I know what's the problem but I don't know how to fix it so I can get it get it in json
const discord = require('discord.js')
module.exports = async (bot, channel, user) => {
guild = user.guild
let embed = new discord.RichEmbed()
.setTitle("Un utilisateur à commencer à écrire :")
.setDescription(`
Nom de l'utilisateur : ${user.username}
Channel où il à commencer à écrire : <#${channel.id}>`)
.setColor('#dc143c')
.setTimestamp()
.setFooter(`Logs serveur ${guild.name}`)
bot.channels.get("657162338184724482").send(embed)
}```
help
Seeing as you're using user.guild which works fine, I assume user is a GuildMember and not a User, GuildMember doesn't have a username property.
As for the deleted channel, are you trying to log the channel the command was used in? It'll show as deleted-channel if you don't have access to that channel.
@earnest phoenix you can do something like this "welcome to %GUILDNAME%" and save in json
and when you use it, you do jsonfile[guildId].joinmessage.replace("%GUILDNAME%",guild.name)
.replace
where?
let joinmessage = JSON.parse(fs.readFileSync("./setjoinmessage.json", "utf8"));
if(!joinmessage[message.guild.id]) {
joinmessage[message.guild.id] = {
joinmessage: botconfig.joinmessage,
};
}
let jmessage = joinmessage[message.guild.id].joinmessage
message.guild.channels.get('656407826876596224').send(jmessage);
});```
sorry now my brain doesn't cut much
i already told you lol
now I'm just so stupid or no one knows where to put it? this line jsonfile[guildId].joinmessage.replace("%GUILDNAME%",guild.name)
@quartz kindle please help because it hurts me not to cut
full code
JSON name setjoinmessage.json
code
{"guild id":{"joinmessage":"> Üdvözölek a %GUILDNAME% Discord szerverén\n > Jó szórakozást kíván az \n > OTAMOON csapata"}}
index.js
code
let joinmessage = JSON.parse(fs.readFileSync("./setjoinmessage.json", "utf8"));
if(!joinmessage[message.guild.id]) {
joinmessage[message.guild.id] = {
joinmessage: botconfig.joinmessage,
};
}
let jmessage = joinmessage[message.guild.id].joinmessage
message.guild.channels.get('656407826876596224').send(jmessage);
});```
anyone can help because I really don't understan
🥄
?
its a spoon. for spoonfeeding.
lol
@earnest phoenix what's your native language
How I could split (on nodejs/d.js) message content into array like this message content is: halo | no yes and then the array would become : ["halo", "no yes"], i tried searching from mdn and stackoverflow but i didnt find the right one.
.split(" | ")
lemme trr
@west raptor Hungary
oh
hmm ?
i didnt mean that like it splits into arguments/params
i mean like the luca bot command kick -kick user reason | time
database or json backup which is better
and which database eg: xlamppmysql linux server or mongodb linux server
it really depends on your situation
mongodb might be the better in your situation
mongo has great support JavaScript
good because i don't know how to use install etc ..
you can give me some guidance
video?
thank 😛
if (command === "avatar") {
const rUser = message.mentions.users.first();
if(rUser === null) {
const authoravatar = message.author.avatarURL
const authorusername = message.author.username
const embed = new Discord.RichEmbed()
.setAuthor(authorusername, authoravatar)
.setFooter(`CDeveloper's Bot`)
.setImage(authoravatar)
.setTitle("Avatar Url")
.setURL(authoravatar)
.setColor('#ff1493')
message.channel.send(embed)
} else {
const embed = new Discord.RichEmbed()
.setAuthor(rUser.username, rUser.avatarURL)
.setFooter(`CDeveloper's Bot`)
.setImage(rUser.avatarURL)
.setTitle("Avatar Url")
.setURL(rUser.avatarURL)
.setColor('#ff1493')
message.channel.send(embed)
}
}``` it says "username" of user does not exists
(node:11) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'username' of undefined
at Client.<anonymous> (/home/container/bot.js:482:30)
at Client.emit (events.js:198:13)
at MessageCreateHandler.handle (/home/container/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
at WebSocketPacketManager.handle (/home/container/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:105:65)
at WebSocketConnection.onPacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (/home/container/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17)
at WebSocket.onMessage (/home/container/node_modules/ws/lib/event-target.js:120:16)
at WebSocket.emit (events.js:198:13)
at Receiver.receiverOnMessage (/home/container/node_modules/ws/lib/websocket.js:789:20)
at Receiver.emit (events.js:198:13)
(node:11) 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:11) [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.```
its on the right position
and i just came out of nothing
eval does not work..
did you mention anyone
rUser would never be null as it doesn't return that
that's not the issue
rUser would never be null as it doesn't return that
it's going to your else statement
check if rUser exists, as it returned undefined if no user is mentioned
if (command === "avatar") {
const rUser = message.mentions.users.first();
if(rUser === null) {
const authoravatar = message.author.avatarURL
const authorusername = message.author.username
const embed = new Discord.RichEmbed()
.setAuthor(authorusername, authoravatar)
.setFooter(CDeveloper's Bot)
.setImage(authoravatar)
.setTitle("Avatar Url")
.setURL(authoravatar)
.setColor('#ff1493')
message.channel.send(embed)
} else {
const embed = new Discord.RichEmbed()
.setAuthor(rUser.username, rUser.avatarURL)
.setFooter(CDeveloper's Bot)
.setImage(rUser.avatarURL)
.setTitle("Avatar Url")
.setURL(rUser.avatarURL)
.setColor('#ff1493')
message.channel.send(embed)
}
}
oops
never mind that
if (command === "avatar") {
const rUser = message.mentions.users.first();
const embed = new Discord.RichEmbed()
.setAuthor(rUser.username, rUser.avatarURL)
.setFooter(`CDeveloper's Bot`)
.setImage(rUser.avatarURL)
.setTitle("Avatar Url")
.setURL(rUser.avatarURL)
.setColor('#ff1493')
message.channel.send(embed)
} else {
const authorusername = message.author.username
const embed = new Discord.RichEmbed()
.setAuthor(authorusername, authoravatar)
.setFooter(`CDeveloper's Bot`)
.setImage(authoravatar)
.setTitle("Avatar Url")
.setURL(authoravatar)
.setColor('#ff1493')
message.channel.send(embed)
}
}``` this?
nope, you still need that if statement
what to look at then? if rUser = true?
or something
i could use if args = null
so i add a const of args
but you need to check if it exists by seeing if it equals undefined or using a truthly value
ah undefined
@surreal sage
let rUser = message.mentions.users.first() || message.author
@sudden geyser else he never learn.
One message removed from a suspended account.
How can i make that? https://tayron.is-inside.me/Ow7Iq1Ld.png
lol
a bot is online on mobile how can i do that too?
https://tayron.is-inside.me/2G2mtfWS.png i have that @surreal sage
Read the docs
I think
or if he does host it mobile or smh
i mean like if it detects if its hosted on mobile
lol it doesn't detect anything
it's just an identifier you can send to the api to indicate the activity is on mobile
the mobile apps do it automatically in the behinds
^
you're allowed to use the mobile indicator on bots
Does d.js Member inherit User so that devs could use <Member>.username or does that vary per version
you have to use <Member>.user to get the <User>
How i can make the reason thingy work (on d.js-master) ``` message.guild.members.ban(user.id, { options: { days: 7, reason: a[1] }})
a[1] is the reason btw (and it does ban the user and a[1] isnt undefined)
You shouldn't have to wrap it with options it should know that by default.
so just { days: 7, reason: a[1] }?
YEah
k
Also you ban on the guild and pass it the member.
Unless there's two ways to ban?
Lemmie check real quick
ban
Yeah there is. 😄 Glad to help.
message.guild.members.find(... u.user.tag and u.user.tag ...) is very unstable on d.js 😞
Unstable? What do you mean?
it sometimes picks random member even tho member exist in casesens
you can do guild.members.fetch().then((members => {members.find(i => i.d.k == "Which statement u will use")}))
maybe
expect im on d.js-master and fetch() method is deleted.
oh yea
not guild.fetchMembers()
import { CrunchyRoll_Today } from CrunchyRoll``` js op
xD
for some reason
it didnt want to pull it out of the folder that i was next to
so i moved it up one directory
and it worked
idk why
but somtimes weird things do weird things
Not JS until you remove all form of snake case
kubernetes
that's why i call them k8s
2 hours into the k8s course
this is actually sicc
this man goes absurdly in depth explaining every command and what happens behind the scenes
cant recommend him enough
@earnest phoenix never really looked into kubernetes, what is it
its a container management & automation & load balancing & networking of machines
wew
that graph above he was explaining how the master (k8sapi) handles distribution of workload
like if i specify in the config to launch 10 instances of a bot, it will defautly start like 3 on each vm/machine or we could specify which pods / vms to run on in config
its really cool if your into like enterprise level scalability and architecture @west raptor
the full workflow is i push code to github -> it goes to travis ci for build & testing of images -> travis ci publishes to docker hub -> kubernetes handles the updating & distribution of containers across machines/vms and sets up networking & load balancing
so idealy i just push to github and bam badaboom it is distributed across all my servers andd scales as need be
yea its mega cool
if you dont know about a container software i recommend doing docker first though
since k8s is pretty much orchestration of containers and images etc
Hi is so I can put ranks on my discord
is you can has english properly
One message removed from a suspended account.
@earnest phoenix Your in the wrong place, that would be better suited for the general discord help server. This is focused around bot development

Anyway to fix this in vscode? All the deps are in the shell.nix could not compile `libc`. process didn't exit successfully: `/nix/store/a05a9mh9vyaj8gq559c5ymxr6i059hdh-rust/bin/rls --crate-name build_script_build /home/april/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.66/build.rs --color never --crate-type bin --emit=dep-info,link -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="std"' -C metadata=0b28db3be857b546 -C extra-filename=-0b28db3be857b546 --out-dir /home/april/dev/rust/rin/target/rls/debug/build/libc-0b28db3be857b546 -L dependency=/home/april/dev/rust/rin/target/rls/debug/deps --cap-lints allow --error-format=json --sysroot /nix/store/wcffbmgzlv3sk47h0lfvb86vy9ki42q3-rust-1.40.0-2019-12-16-73528e339` (exit code: 101) error: could not compile `cfg-if`. error: could not compile `lazy_static`. error: could not compile `autocfg`.
Is it possible to import a variable into a module without constantly requiring it?
for example not having to be doing this
//Module.js
exports.logmsg = (msg,color) => {
console.log(msg + color)
}
//index.js
const log = require("Module.js")
//First function
log.logmsg(message,"BLUE")
//Second function
log.logmsg(message,"RED")
that I don't have to be putting the "message" variable in the function
You could make an instance through something like a class.
how?
if you're just making a helper function I'd rather keep passing the message as an arg, but if you want to have that log class have multiple methods like logging errors, you can use a class.
class logg {
constructor() {
this.message = message;
}
logmsg() {
// logic here
}
}```
some people don't know what classes are
so we don't suggest them
because most bot devs just copy pasta and spam us with reference errors that x is undefined when they copieed it
If it makes sense to use a class, there's no reason not to.
If the person doesn't know what a class is, explain it to them
only one way to learn how to use classes 
👏 @dusk thorn
@low wasp Want me to explain what I'm trying to accomplish so you understand?
Yep
That function that I posted works in a way that it sends a message and waits for the result from the person that issued the command that this function is used in. In this new case I need to change it to allow for another person to give it the answer it desires.
The command is to be issued by someone else then the person answering the question this function puts out is mentioned in the command
command @mentionPersonThatWillAnswerThisQuestion
So you need to get the mentioned user and put that in the filter
I'm not entirely certain on how I can go about that, I'm still kinda stupid when it comes to a lot of this stuff
Get the mentioned user and the filter becomes m => m.author.id === <mentioned>.user.id
@dusk thorn
You can send the filter through when you call the function
let listenFilter = (m => m.author.id === mentioned.user.id)
waitor(message, text, listenFilter, etc)```
@dusk thorn
I seen
How would I use listenFilter over the regular filter?
I only want it to be active when I call for it
Ur function checks if filter is sent into the function and uses it
I'm still completely oblivious, I'll ask my partner who actually made the function how they could do this 
Tiny brain cannot figure out how 
The function uses filter if it is passed into it when the function is called
bruh so idlerpg is able to set their status to idle
how do I learn this secret technique
It's called read your lib docs 
Is there any way to get the person who deleted a message from the messageDelete event on discord.js?
yes 🙃
oh
fetch latest audit log ig
if there is none assume it was the user's own message
so message.guild.fetchAuditLogs.first()
Oof
https://discordapp.com/channels/264445053596991498/272764566411149314/657424214013378570
What would that mean?
@valid frigate
Thats what im on rn
from what i hear the library docs have a bad reputation lolw
im just blind asf
Guild#fetchAuditLogs() then the entries property
which is a collection
so first() should work
@west raptor Thanks, it was just js let logs = message.guild.fetchAuditLogs().then(logs => { let embed = new Discord.RichEmbed() .setTitle("Message Deleted!") .addField("Author:", message.author) .addField("Executor/Deleter:", logs.entries.first().executor) .addField("Content", message.content) logsChannel.send(embed); });
For future reference
what
Eris and discord.js are similar in getters
discord.js personally is better
what is or in a statement like › || « and ‹
oof
Or exists it just isn't written as or it uses the operator ||
^
Nvm too early for this
I’m looking to have a bot to assign roles. Can anyone help me with this?
@river tartan you can use @opaque light it allows you to create reaction roles where you click a reaction to get a role
@prime cliff alright. How do I get Zira?
Got her. And how do I get the right roles?
View the guide here https://zira.discorddocs.com/docs/en/start/
@slate wave You should make a condition because when a person deletes their own message it's not in the logs.
Thanks
help me
//prefix lekérése
let settprefix = JSON.parse(fs.readFileSync("./setprefix.json", "utf8"));
if(!settprefix[message.guild.id]) {
settprefix[message.guild.id] = {
prefix: botconfig.prefix,
};
}
let prefixs = settprefix[message.guild.id].prefix
//prefix lekérése
let nyetEmbed = new Discord.RichEmbed()
.setColor('#ff5930')
.setAuthor(`${botusername} - ERROR`, bot.user.displayAvatarURL)
.setThumbnail(bot.user.displayAvatarURL)
.setDescription(':no_entry: You do not have **permission** to use this command! :no_entry: \n\n For more information ' + prefixs + 'permission-help ');
if(!message.member.hasPermission("MANAGE_GUILD")) return message.channel.send({embed: nyetEmbed});
if(!args[0]) return message.reply("Please read to welcoem msg-t");
let joinmessage = JSON.parse(fs.readFileSync("./setjoinmessage.json", "utf8"));
joinmessage[message.guild.id] = {
joinmessage: args[0]
};
let jmsg = joinmessage[message.guild.id].joinmessage
fs.writeFile("./setjoinmessage.json", JSON.stringify(joinmessage), (err) => {
if(err) console.log(err);
});
let prefixEmbed = new Discord.RichEmbed()
.setColor('#30a2ff')
.setAuthor(`${botusername} - SetWelcomeMessage`, bot.user.displayAvatarURL)
.setThumbnail(bot.user.displayAvatarURL)
.setDescription(':white_check_mark: Successfully changed welcome message ``' + jmsg + '`` :white_check_mark:');
message.channel.send({embed: prefixEmbed});
}
``
' + jmsg + '
thats the issue
also i cant freaking send it cuz its triggering
grrr
setwelcome error
send just does not detect the whole welcome msg
only >
setwelcomemsg coomads
setwelcomemsg this will
Szerver welcome message:
>
someone looking at what can i send invite link to test server and see what's wrong with me
just write a dm
pls help me
They are not necessarily different in perfomance
Its just two different libraries that do the same things but differently
ok
Both of them can be extended and hacked to increase performance
Also "performance" is relative, it can be ram usage, network usage, cpu usage, processing time, latency, etc...
altho not advised unless u know what youre doing fully
I’m figuring out how to use Zira. Which page of the manual is for members to request roles?
this is the wrong server for that, @river tartan
you need to find @opaque light support
although i use that bot and i didnt struggle to set it up
cant remember where the help is though
im making a rich presence in discord.py which update the no of users for that i need help please
My code:
game = discord.Game(f"@mention help | Listening to {len(client.users)}")
await client.change_presence(status=discord.Status.online, activity=game)```
and created a loop task
`client.loop.create_task(loop_presence)`
So what's the problem
it gives AssertionError
i want to update the presence every 10mins that the no of users will also update
Can I see the error traceback
Exception in default exception handler Traceback (most recent call last): File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.6/asyncio/base_events.py", line 1285, in call_exception_handler self.default_exception_handler(context) File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.6/asyncio/base_events.py", line 1257, in default_exception_handler value = repr(value) File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.6/asyncio/base_tasks.py", line 15, in _task_repr_info coro = coroutines._format_coroutine(task._coro) File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.6/asyncio/coroutines.py", line 274, in _format_coroutine assert iscoroutine(coro) AssertionError
I suggest you use discord.py tasks instead of making it youself
That should fix it I think
@golden raven you code is right but it needs the () after the subrutine
from discord.ext import tasks
@tasks.loop(minutes=10)
async def update_presence():
...
update_presence.start()```
Your code before won't loop btw
It will only run once
theres no issue creating your own tasks
@modest maple it gives
Task exception was never retrieved future: <Task finished coro=<loop_presence() done, defined at <string>:23> exception=AttributeError("'NoneType' object has no attribute 'change_presence'",)> Traceback (most recent call last): File "<string>", line 25, in loop_presence File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.6/site-packages/discord/client.py", line 874, in change_presence await self.ws.change_presence(activity=activity, status=status, afk=afk) AttributeError: 'NoneType' object has no attribute 'change_presence' ```
game = discord.Game(f"@mention help | Listening to {len(client.users)}")
await client.change_presence(status=discord.Status.online, activity=game)```
`client.loop.create_task(loop_presence())`
where have you put this in reference to the rest of the code?
You didn't wait for the bot to be ready I bet
You can't change the presence if the bot hasn't logged in yet
@modest maple can't understand
it contains 300lines
Put it in a hastebin
but it might be cuz its not in the on_ready event but seeing that its a NoneType it might be that its getting called before actually defining client
also are you using Bot or Client?
It's because the websocket is none before it logs in
Change presence is through the websocket so if you don't have a websocket yet...
@modest maple https://pastebin.com/scKbyyBk
It's referenced in the presence change coro before being defined
@winged thorn ok now i will change
Just move the Coro below where you define client
And that ^
move ur commands into a seperate file
Well he doesn't need to
ok
It still works fine
he doesnt need to but it saves alot of effort in the long run
Cogs are the answer
so you dont end up with a multi thousand line file where finding anything takes 20 mins
and no
cogs are not
but what ever
xD
Hmmm
Cogs are actually cool until you stop auto-loading one on bot start and wonder why it's not working
At some point you give up on explaining HOW it works and just let them figure out the ready code or let them suffer
yh
welp i just got 2/3 of the way into organising a DB to realise i missed a column
FFFFFFFFFFFFFFF
mongo for life 
NoSQL gut
SQL Alchemy is G and Very useful
ik
got a bit of a weird SQL lite bug
its Saving changes when removing a row
but on reboot it goes back to how it was
Adding items is fine
but its not saving changed by the delete command?
even tho:
Release_Conn.commit()```
is working fine
nvm
i found it
fecek
var images = {
sonic: {}
}
images.sonic = function () {
let response = 'ok'
try {
require("axios").get('https://sonic-bot-api.glitch.me/api/v1/images/sonic').then(function (Response) {
response = Response.data
})
} catch (err) {
console.log(err)
}
return response
}
exports.images = images
this code is for my node module
it is supposed to get a random image from my api
with the axios module
which comes with the node module
but it returns nothing
Because the response is set in a .then()
Hello, very sorry I wanted to ask why mentions arent working on my code, as they used to about a week ago.
.then(var => {}) isnt enough? i think then wont accept function
But since then it is not working.
what else could I do then
make ur then into .then(res => {})
@next grove mentions used to be <@userid> for regular members and <@!userid> for nicked members
One of the recent updates made it so that your mentions are changed to <@!userid>
because if I use axios.get and make it a property instead of a function it works normally
Which is probably not supported in your code
recent
its been it since like almost year alrdy
No
It was working a week ago but seems to be broken now.
So, I would call it recent. If that is the issue that is.
It changes mentions to <@!userid> since the markdown/emojis/mentions are shown in your editor
Not just canary anymore
Yeah, okay thank you 🙂
on stable too
I will try that!
oh on stable too
just check if it is either <@ id > or <@! id >
Yeah.
<@id> should be invalid now
it seems many ppl has canary then cuz my bot has been recieving <@id> and <@!id> like ~ 4 months alrdy
<@id> = username
<@!id> = nickname
And sends it as <@!userid>
<@! has been on mobile always
Okay, well I will try that 🙂 thanks.
Bots can still send them like that
I tested around
Any mentions sent by users are changed into that format
unless they use a selfbot I guess
or outdated discord
ok so
I changed it now to js try { require("axios").get('https://sonic-bot-api.glitch.me/api/v1/images/sonic').then(res => { return res.data }) } catch (err) { console.log(err) }
but I still get nothing
it does print the url
like it should
but if I do console.log and the function
then it returns undefined
this is when I call the function
hmm
and this is what is in the logs
is the function async
I recommend doing const data = await <request> which <request> is the request thing
try making the function async and use await and return the value from axios
and make the message event async and do await func() which func() is the function you're using asynchrously
images.sonic = async function () {
try {
await require("axios").get('https://sonic-bot-api.glitch.me/api/v1/images/sonic')
.then(res => {
console.log(res.data)
return res.data
})
} catch (err) {
console.log(err)
}
}
something like this?
not quite
do const res = await <request>
and then return the data (res.data)
<request> is the axios request
images.sonic = async function () {
try {
const res = await require("axios").get('https://sonic-bot-api.glitch.me/api/v1/images/sonic')
return res.data
} catch (err) {
console.log(err)
}
}
so this?
mk
well if I console.log it it does show the random image link even with sync function and not async
yea
you can do sonic.images.sonic().then((data) => console.log(data)) if you don't like using await
since sonic() is a Promise, you can use then to get the value
well I changed it now
lets hope it works
still doesn't return anything
when it console.log's the res.data its all working fine
execpt if I use return
it's not really "weird"
you're not doing it right
sometimes when you use then to return something, it can get tricky
when i try to fetch smh from my db and it returns promise so if i do db.fetch({ where: { id: ??? } })
and return that it wont work
ur welcome linko 
xd
no problem 
okay, discord's redirect URI gives me aids
can someone please help me unravel the mystery of what redirect URI I need to use for people to login to me site using discord?
so you basically want to implement oauth?
yes, and I have done it before, worked fine then. But not working now for some reason
when I was locally testing, I used https://localhost/callback and that works... But when I try to put my actual website in there, it comes back with invalid OAuth2 redirect_uri after clicking the login button
you need to add the redirect url for dev & prod instances in the OAuth2 tab of your application
this works on my forum page.... The second I switch to the other url it stops working. The URL is included in my config as well as the OAuth2 page
is the censoring mandatory, because it's kinda easy to see through it
well
also you can't redirect to localhost since discord can't see it
if that's what you meant
what is the other url?
ShareMyBot.com is a bots and developers platform. You can upload your bot to the website, adding details and descriptions about it which can result in people adding your bot to their server.
oh
I really need this to work and I have no idea why it won't
so you want to allow users to login via discord
in that case it's probably your callback endpoint that's at fault
do you have any site errors/logs?
nothing shows up when I try
see if you can get some kind of error to appear/console log the flow of your code
I have been, nothing shows up. It just says the bot client is ready, list is started and then nothing after that
maybe
is there actually any difference between print()/input() and stdout.write()/stdin.readline()?
as in
does print output to stdout?
does input read from stdin?
is there any performance impact?
(all this considering python 3.6)
idk about python, but in node, writing to stdout doesnt automatically add new lines, while console logging does
does print() add new lines?
yes
yeah then thats probably one of the differences
performance impact should basically be the same as appending a new line to a string
according to my teacher its a very significant impact, and the code testing thing does not recognize output from print
(which i call bullshit as it worked for us with print but eh)
heres one of SO's answers
print 99
is equivalent to:
import sys
sys.stdout.write(str(99) + '\n')```
so basically conversion to string plus appending a new line
there seem to be a few more intricate differences too, depending on the py version, you can look at some answers in there
im only concerned about possible performance impact
the way the code is scored is that they first compile it to an executable, and run that
and appearently using print affects the performance of that?
how much do you have to print?
the difference should be negligible lol
but you can time your executable by running it in a linux terminal/bash
the thing is
noone knows what they use to compile it to an executable
cuz there are like a dozen tools for doing so
welp
i dont think it will make a difference, but using std directly should be nanoseconds faster
lmao
if you're only printing one thing, it doesnt really matter
printing multiple things is what actually hits performance
inputs however can be up to a few dozen lines
idk the difference between input and stdin, you can probably google that
but generally input and print are wrappers around std, so they should provide several goodies and handle several situations that you would need to manually account for if you use std
heya I have a little problem with my code it say it an error line 21 but I dont find the error someone help
the script

stop coding on mobile
because mobile is not a platform to develop on and you're bound to make syntax errors with a mobile keyboard
message doesnt exist in that scope
are you copy pasting code randomly?
nope
Not the only issue
do you even understand what your code does
then you should understand that message doesnt exist there
random bitwise operator in there
probably supposed to be a ||
im more intrigued by the random client.destroy() in there lul

lmaoooo
he left
lmao
Can someone help with this? I'm trying to return the first value of results except I keep getting this error ```
error[E0507]: cannot move out of index of std::vec::Vec<db::model::Guild>
--> src/db/mod.rs:46:5
|
46 | results[0]
| ^^^^^^^^^^ move occurs because value has type db::model::Guild, which does not implement the Copy trait
error: aborting due to previous error
For more information about this error, try rustc --explain E0507.
error: could not compile rin.
To learn more, run the command again with --verbose.```
here's the code ```rs
pub fn get_guild(guild_id: i64) -> model::Guild {
let connection = establish_connection();
let results = guilds.filter(id.eq(guild_id))
.load::model::Guild(&connection)
.expect("Error fetching guild");
results[0]
}```
The only thing I could possibly think of that would cause this is &connection
except I don't know how to fix it
according to stack overflow and a guess at the error:
it doesnt like the fact that the type of data used doesnt have the "copy" trait, Stack overflow seems to advise Borrowing rather than copy
but i have no idea about rust so thats about as much of a guess as i can do
I could implement Copy to guild except Guild has String values
Well Strings are unknown as compile time thus can't be copied
ended up fixing with results.into_iter().nth(0).unwrap() which just turns it into the iter, gets the first value in the iter and unwraps it
cannot move out of index of std::vec::Vec<db::model::Guild>
Could it be that results is empty?
No
this is a compile time issue
not runtime
I still have to error handle if results is empty
which I really don't know how I'm going to do
would guild.filter.first work to get the first result?
i dont know rust so i might be completely off
Yeah, it would be pretty obvious to try that
``` im scawrd
huh?
oh fucc
the length of an embed description?
sounds long enough for most things
i made a search system
but turns out
crunchyroll gets people aswell
so it was grabbing 20000 results
:/
Also anybody know how I could error handle this? I could check if the guild is in the database on message but that would be redundant and would slow down response times
How to make prefix as a word. Like vibi. I want to make like vibi help. But didn't work.
Did you try giving db::model::Guild the Copy trait?
I guess for some unknown weird reason it really wants to copy it somewhere deep inside there
hmm sorry then i dont think i can help =/
which can't be copied because it's size is unknown at compile time
I meant what should I do to ensure the guild is in the database
I fixed the original issue i had
How can i add restriction channel ? 🤔
.unwrap() can panic if it is a None type
but I want to ensure it will always be there without actually handling the error in the get_guild function
@white sequoia read the docs, its managing channel permissions
@summer torrent It purely depends on how you handle prefix's and messages / commands
How do I make people able to use commands only for a particular channel, e.g. you can use this command only on #test
Chill can u give me code ? idk 🤷♂️
check the message channel's id against your desired id
every time someone uses the command check the ID of the channel where they use it and compare it to the channel ID of the channel where it is allowed to be used
So in many words what cry said in a few words
-,-,
no spoonfeeed for u 





