#development
1 messages · Page 621 of 1
what
Vedal alt confirmed 
ye tru
i need to find an alternative to the rubbish library discordbots has to offer
for python
voting
and user count
well, its quite simple and you could just make your own
i need to know how doe
well, generally you can just send GET and POST requsts
and for the webhook you just make a webserver that accepts the requests from dbl
i need to learn hm
Its ez
Where can I read a good description of webhooks? I’ve looked up some stuff about it but I still have no clue what they actually are or what they’re for
you can literally google what webhooks are, they are like reverse API
Lol
lmfao
Webhooks are a cool way of subscribing to events and enriching your application. Check it out! Hope you enjoyed the video! Join my Discord server to chat wit...
yes
Isn't it sweet when people call your stuff rubbish but don't wanna leave actual feedback
yeah, it really is
@topaz sphinx you can use Flask for your Python webhook
Not sure why you don't wanna use the dblpy autopost feature at this point with on_dbl_vote/on_dbl_test events
Ez
It would be even better if you didn't just say "its ez" without explaining or posting any helpful article/video
Hello,
i am not very good at coding and have some code in nodejs with promises and async await. This code has one big try-catch block over 4 awaits (2x send message and 2x awaitmessage). However, if one of the sendmessage promises reject, i need a different catch block.
As the 4 awaits alternate (sendmessage, awaitmessage, sendmessage, awaitmessage) i would have to make 4 try-catch blocks, and cannot group them together somehow? is there a better way?
if (fs.existsSync('data\\' + message.author.id + '.txt')) {
var varpoints = fs.readFileSync('data\\' + message.author.id + '.txt').toString().split("\n");
points = parseInt(varpoints, 10)
var points = points + 1
fs.writeFile('data\\' + message.author.id + '.txt', points, function(err) {
if (err) throw err;
});
} else {
let data = "1"
fs.writeFile('data\\' + message.author.id + '.txt', data, (err) => {
if (err) throw err;
})
}
This code still doesn't work.
i dont think data\123456789.txt is a valid path
FINALLY FIXED MY BUG
I had to use parseFloat()
client.on("message", (message) => {
if (message.content.startsWith("s!points")) {
if (fs.existsSync('data\\' + message.author.id + '.txt')) {
var varpoints = fs.readFileSync('data\\' + message.author.id + '.txt').toString().split("\n");
const embed = new Discord.RichEmbed()
.setAuthor("Points")
.setColor(0xffff00)
.setDescription('**Points**: ' + varpoints)
.setFooter("Created By Two#9923", 'https://cdn.discordapp.com/avatars/276497792526974996/accdaa8eff668a29b84e0e2d2b6f1610.png')
message.channel.send({embed});
} else {
const embed = new Discord.RichEmbed()
.setAuthor("Points")
.setColor(0xffff00)
.setDescription("0")
.setFooter("Created By Two#9923", 'https://cdn.discordapp.com/avatars/276497792526974996/accdaa8eff668a29b84e0e2d2b6f1610.png')
message.channel.send({embed});
}
}
});
client.on("message", (message) => {
if (fs.existsSync('data\\' + message.author.id + '.txt')) {
var varpoints = fs.readFileSync('data\\' + message.author.id + '.txt').toString().split("\n");
points = parseFloat(varpoints, 10)
var points = points + 1
fs.writeFile('data\\' + message.author.id + '.txt', points, function(err) {
if (err) throw err;
});
} else {
let data = "1"
fs.writeFile('data\\' + message.author.id + '.txt', data, (err) => {
if (err) throw err;
})
}
});
Simple Points System
Which page
^
any chance someone helps me with the raw data to change the bot's status ( online, idle, dnd )
english
java script
Yeah.
https://discord.js.org/#/docs/main/stable/class/ClientUser?scrollTo=setPresence
client.user.setPresence({ status: 'idle' });
https://discord.js.org/#/docs/main/stable/class/ClientUser?scrollTo=setStatus
client.user.setStatus('offline');
When I want the bot to send the nickname of a person who is not in the server where the command is made, he does not say his name in mention but normal.
How do I do that?
so:
guild.owner.username
depends
here
.addField("👤 __Propriétaire__ :", guild.owner, true)
yes
guild.owner.user.username
That should work.
and here ?
let auteur = message.user.username;
let sug = new Discord.RichEmbed()
.setColor("GREEN")
.setTitle("💡 • Nouvelle suggestion")
.setDescription(`${suggestion}`)
.setFooter(`Auteur de la suggestion : ${auteur}`)
bot.channels.get("580064675996237864").send(sug);
Its not working
message.author.username
^
@earnest phoenix message.guild.owner.tag
message.author.username is fonctionnaly
what
Ik
What is your primary language tho
Ah cant help with that then rip, sorry
Well I can, but not in french 
What did you need
@surreal wasp best dev, js god =))
for discord bots js is good, but for general programming i prefer java or python
^^^^
JS isn't all that perfect, and that's a statement from someone who uses it often.
It's bad when it comes to performance and memory, in some scenarios.
😅 I am making a bot, with a lot of json files for data, and J's didn't like it.
the nicer the language (how badly you can break the os) the worse it is on ram single matter of how they work
What r u using JSON files for?
Making a Pokemon bot
Yeah but what types of info do u store in those json files
if you have access a database might be better
^
Player stuff and the Pokemon info that has been caught
Yeah... that's a bad idea
yeah look at something like mysql
I was thinking doing database
Imo SQLite is better for those who r just coming out of JSON land
true
Since it's also file-based
Oh yes, json is good, but can't handle much.
JSON isn't intended for that, that's the problem...
You can't write/read to it simultaneously
Yes
you cant read/write simultaneously on sqlite either
Ikr but for practice it's good
So if two users send a message around the same time, it will error.
Know time to watch how to connect to a SQL database with c#
if your able to run a db its better but if you can sqlite is the way to go
changing between the two (mysql and sqlite) at a later date isnt a huge amount of work compaired to moving off json
Yea, I have to check to see what is good for c#
support for both iirc is in it
In JS, switching between SQLite and MySQL is as easy as replacing a single string tbh
either is better than json though for what your doing
Since most ppl already use a query builder like Sequelize
@opaque eagle for most part
but if your doing more advanced queries its a bit more painful
Yea, i was really was using json to check to make sure the logic I have for catching and selecting works
ayeee marco nicknamed me to eslint ./node_modules/
So every time someone pings me they say that lmao
@opaque eagle ../../
Both options should be free right?
yeah
That's good for me then 😅
thats why they are both so popular lol
Lol
only popular db that costs afik is oracle but yeah dont need that
Can I nest a db in another DB, like an array in an array?
you can have multiple tables it think what your after?
each table has columns
its like a big multiple page excel document
Well I have to have them separately then call on the the cell number?
so like you might have
userId, userName, profilePic
then you can access via
SELECT * FROM users WHERE userId=1234
you can have as many tables as you need as well
Wait does it add new data in a new row and column
its just like a big excel sheet
Oh ok
thats what it looks like to store data in it
and you can have as many tables/sheets as you need
you would use a db over json as it makes handling large amounts of data much easier and cleaner
further it can scale really well
So what would be best if I need to nest an array in the DB. I need to have the pokemon to have either IVs with the Mon so it's easier to call on.
im not sure need for array maybe do you wanna list the data your storing (wanting to) and can help figure out what your needing
Am I not home at the moment, but I can try my best and show what it kinda of looks like
client.on('message', message => {
if (message.content === 's!fight') {
if (fs.existsSync('data\\coins\\' + message.author.id + '.txt')) {
if (!message.mentions.users.size) {
return message.reply('You need to tag someone to fight them.');
}
const taggedUser = message.mentions.users.first();
if (message.author.presence.status = "online") {
if (taggedUser.presence.status = "online") {
message.channel.send('This is a test for now.')
} else {
message.channel.send("Sorry, but the mentioned player must have **ONLINE** status.")
}
} else {
message.channel.send("Sorry, but you must have **ONLINE** status.")
}
} else {
message.channel.send("Sorry, but you haven't started the game yet.")
}
}
});
It doesn't pass the "must mention user" action.
[ ping me ]
{
'playerid':{
'credits': 200,
'pokemon':{
'name': pokemonName,
'level': Pokemon level,
'nature': pokemonNature,
'IV':{
'hp': PokemonHp,
'atk': PokemonAtk,
'def': Pokemon def,
'sp_atk': PokemonSpAtk,
'sp_def': PokemonSpDef,
'speed': PokemonSpeed
}
}
}
}
Also... I notice that you lack a basic understanding of JS
It's something similar to this
what's the difference
One sets a value, like when you declare a variable... the other checks if a value equals another
Again, we shouldn’t have to explain this to you... you should know this already.
It’s like asking if commas and periods are the same thing...
You don't need to use 3 = 2 works for checking if they equal
eh I started javascript few days ago
Np, I’d just suggest learning js before trying to work on a project (and that’s being said in the nicest, least meanest way possible)
kinda learned a lot\
It’s like trying to write a research paper without knowing grammar rules... gonna end badly.
gets an a on that research paper
xD
@opaque eagle it's like bowling two handed without learning, i would turn out a mess
It's the sixth day since I applied for my bot :/
I remember it being really fast the last few times I applied. 😰
It takes at most 2 weeks
This is probably a dumb question, let's say I put user IDs in a .txt file and in Python did this:
f=open('verified.txt','r')
AllUsers =f.read()
f.close()
for message.author.id in AllUsers:
return
Would it work as a sort of DB
I guess
What is the raw data to make the bot create a channel in a specified Category ID? ( lang = java script )
iirc you can't create them in a specific category, however you can make the bot create the channel and then move it to that category
^
ok then
I mean running a command like s!createchannel [channel name] [category ID]
Strip channel name, then use the ID and move it
message.guild.createChannel(args[0], 'text').then(channel => channel.setParent(args[1]))
message.channel.send("Done")
i need someone i could abuse to get my python code working with dbl
voting
cause i am seriously stuck
@topaz sphinx ?
Like ping the crap out, get kicked n banned in the face
Wdym
Ping pls
@copper cradle ye it worked how I thought it would. I just wanted to see if someone else did it that way. Changed it to be this:
f=open("verifiedusers.txt","r")
users =f.read()
if message.author.id in users:
print("verified")
@west spoke ok
I just didn't have access to my computer yet
@balmy lantern i need to handle more than 1000 votes/month
how do i do that
also need to know how to ignore exception thrown from bot
bot.on("member", async (member) => {if(member.bot){member.addRole('579514182441893899')} })
no err
that's not an event
the event you're looking for is
guildMemberAdd
@pallid zinc
np
it dont work
bot.on("guildMemberAdd", async (member) => {if(member.bot){member.addRole('579514182441893899')} })
bot.on("guildMemberAdd", async (member) => {
if(member.bot) {
member.addRole('579514182441893899');
}
});
what's the error
no err
bot
does a bot have a role thats above the one its giving
^
yup
yup
send a pic of the thing
what thing
bot.on("guildMemberAdd", async (member) => {if(member.bot){member.addRole('579514182441893899')} })
code
let role = args[0];
if (!role) return
message.channel.send(`**${message.author.username}**, role not found`)
message.guild.members.filter(m => !m.user.bot).forEach(member => member.addRole(role))
message.channel.send(`**${message.author.username}**, role **${role.name}** was added to all members`)
break;
```
I am currently in the process of making a simple Q&A bot for my friends. I was wondering, is there any way to make this so it isnt case sensative when looking for a trigger?
if (msg.content === '') {
msg.reply('')
}
})```
just convert their message to all lowercase
im new to coding
ok, me too, let me find the right thing here 😃
give me an example of what the message the person would be typing
'who is gary gygax?' but the way i have the message coded is 'Who is Gary Gygax?'
i figured since theres the option with certain bots custom commands to ignore case sensativity you could do it with any bot, as long as it was coded.
give me a few mins im in the middle of a game ill help when its done 😃
ok thanks.
will that make it so they can type it either way though?
ok, let me finish this and ill help out, its not as simple as i was thinking
ok, thanks, ill be back in 5, steppen outside
ok
Lol
im back
so I was on the right track?
well, it works, well, with the simple part about it repeating the response every second now lol
had to reset it
let role = message . guild . roles . find ( role => role . id === args[0] )
if ( ! role) return
message . channel . send ( ` ** $ { Message . author . username } **, role not found ` )
message . guild . members . filter ( m => ! m . user . bot ). forEach ( member => member . addRole (role))
message . channel . send ( ` ** $ { Message . author . username } ** ** role $ { role . name } ** Was added to all members ` )
break ;
```
No err
Wtf why spaces everywhere AHHHHHH
any idea why my bot isnt responding in the testing channels? does it need to be approved first?
Nope
@pallid zinc what do you want exactly?
Prefix?
i use !
I want to role everyone @earnest phoenix
@vital nest the bot need to be here
Yup
If you dont get any dm from lucas, wait approvation
bation*
@pallid zinc you forgot a "s"
At message.guild.roles
Ah no
@pallid zinc remplace role.id
By role.name
ok, so I need to wait for it to be approved and then it will join the server?
@vital nest yes
And I have "s" there
Let me check
it still repeats the response every second, when i add what GOD said to put, the
if (msg.content.toLowerCase('')) {
msg.reply('')
}
})```
it repeats every single response to every single trigger until i reset or disable the bot.
What?
add a break
Remove .toLowerCase
What do you want rogue?
Lemaaa still same
rougue send the code for the entire command
i need this
if (msg.content === 'ping') {
msg.reply('Pong!')
}
})```
to not be case sensative when the member types the trigger message. i know bots custom commands can be set to ignore case sensativity.
@pallid zinc args[0].toLowerCase
Ok
const client = new Discord.Client()
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`)
})
client.on('message', msg => {
if (msg.content === 'ping') {
msg.reply('Pong!')
}
})
client.on('message', msg => {
if (msg.content.toLowerCase('')) {
msg.reply('')
}
})
client.login(' >>>n/a<<< ')```
when i put the .toLowerCase, it spams
take out the quotes in the parenthesis after the to lower case
Why to put toLowercase
Not asking to you
Saying to @woeful flare
the apostraphes are for the message, i just havent put it in yet
you dont have an equals statement
Still
so everytime a message is sent it will send it again
it only repeats the send if i put in the command the way GOD said to put it.
const client = new Discord.Client()
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`)
})
client.on('message', msg => {
if (msg.content === 'ping') {
msg.reply('Pong!')
}
})
client.on('message', msg => {
if (msg.content.toLowerCase() == "string goes here") {
msg.reply('')
}
})
client.login(' >>>n/a<<< ')```
try that
Wth
i did
where "string goes here" is put your question
@woeful flare what do you want?
he is making a command that will respond to a question
Oh
like What is the date today
but wants it do that no matter how someone types it with caps or not it will work
ok, ill start from the begining
Not working lemaaa
message.contents.startsWith('lul').toLowerCase
Im making a Q&A bot, i want it to not be case sensative.
what happens when you put what i posted rouge
@pallid zinc no error?
put toLowerCase() before startsWith()
Wait 2m @pallid zinc
ok, just fyi, i know nothing, so just telling me a quickslip like that doesnt do anything to help.
im learning this stuff as i go
That doesn't even make sense
let argss = args.join(" ")
if(!argss) return message.channel.send(`**${message.author.username}**, role not found`)
let role = message.guild.roles.find(r => r.name === argss)
if(!role) {
return message.channel.send(`**${message.author.username}**, role not found`)
}
if(role) {
message.guild.members.filter(m => !m.user.bot).forEach(member => member.addRole(role.id))
message.channel.send(`**${message.author.username}**, role **${role.name}** was added to all members`)
}
@pallid zinc
try this
and that means?
1 client.on("message" ..
// Our bot needs to know if it will execute a command
// It will listen for messages that will start with `!`
var ServerID = bot.channels[channelID].guild_id;
if (message.substring(0, 1) == '!') {
var args = message.substring(1).split(' ');
var cmd = args[0];
args = args.splice(1);
switch (cmd) {
// !ping
case 'ping':
bot.sendMessage({
to: channelID,
message: 'Pong!'
});
break;```
something like this format
And put if(msg.author.bot) return like lema said
To prevent the bot from replying to itself / other bots
i use discord.io so things are different if you are using discord.js module
so i remove
})
client.on('message', msg => {```
the second time i have it typed?
Yes
k
You can just move the code you have in the second one to the first one
so back to the main thing im trying to figure out, how do i make it so its not case sensative?
😂
const Discord = require('discord.js')
const client = new Discord.Client()
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`)
})
// MESSAGE EVENTS
client.on('message', msg => {
if(msg.author.bot) return;
if (msg.content.startsWith('ping').toLowerCase()) {
msg.reply('Pong!')
}
if (msg.content.startsWith('string').toLowerCase()) {
msg.reply('string work')
}
// END
})
client.login(' >>>n/a<<< ')
Just googling javascript convert string to lowercase/uppercase would work 🤷
And lema bruh
No
idk if toLowerCase is before or after
Lemaaa still same
Yup
dont delete it x)
Sorry did delete
args[0] doesn't work for find a role
Ohh I deleted
copy pasta what i said, and it should be work
It's not working
Sorry want to say not
why you filter member ?
case "role": let argss = args.join(" ")if(!argss) return message.channel.send(`**${message.author.username}**, role not found`)let role = message.guild.roles.find(r => r.name === argss) if(!role) {return message.channel.send(`**${message.author.username}**, role not found`)} if(role) {message.guild.members.filter(m => !m.user.bot).forEach(member => member.addRole(role.id))message.channel.send(`**${message.author.username}**, role **${role.name}** was added to all members`)} break;
delete break
I don't want to role bots
Ok
and wth
let "role": let argss = args.join(" ")if(!argss) return message.channel.send(`**${message.author.username}**, role not found`)let role = message.guild.roles.find(r => r.name === argss) if(!role) {return message.channel.send(`**${message.author.username}**, role not found`)} if(role) {message.guild.members.filter(m => !m.user.bot).forEach(member => member.addRole(role.id))message.channel.send(`**${message.author.username}**, role **${role.name}** was added to all members`)}
Like this
no wait
let argss = args.join(" ")if(!argss) return message.channel.send(`**${message.author.username}**, role not found`)let role = message.guild.roles.find(r => r.name === argss) if(!role) {return message.channel.send(`**${message.author.username}**, role not found`)} if(role) {message.guild.members.filter(m => !m.user.bot).forEach(member => member.addRole(role.id))message.channel.send(`**${message.author.username}**, role **${role.name}** was added to all members`)}
Like this ^
It is same
no
If I don't put case: "role"
have you heard of indentation
How can executed it
@pallid zinc Ahhh
What
```case "role": let argss = args.join(" ")if(!argss) return message.channel.send(**${message.author.username}**, role not found)let role = message.guild.roles.find(r => r.name === argss) if(!role) {return message.channel.send(**${message.author.username}**, role not found)} if(role) {message.guild.members.filter(m => !m.user.bot).forEach(member => member.addRole(role.id))message.channel.send(**${message.author.username}**, role **${role.name}** was added to all members)} break;
are good
i just woke up
What I sad
@pallid zinc try -role name
Same
i figured it out.....
if (msg.content.toLowerCase().includes('Test'.toLowerCase())) {
msg.reply('Quiz')
}```
and its case-insensitive
Working? @woeful flare
Np
@earnest phoenix still not working
@earnest phoenix fixed it
I need to give role id
To work
Hey
I need some help with reaction collector
So Currently it's looking for reactions on Message sent by user
But I want it to look for reactions on Embed sent by Bot
How I define a SQL database?
Create the reactionCollector on the message sent by your bot
By using .then() on your message send or by using await on it
U saying me?
Not you
Ok
@plucky peak ^^
Define an SQL database?..
You already use .then() on it to add the reactions
So just put the reactionCollector in there too
What's your programming language, Sunny
Hm
I would like it if you told me exactly which database you would like to use
Sql
SQL is not a db
public class LoginManager extends DataManager{ public final static SQLColumn<Long> USER_ID = new LongColumn("USER_ID", false, 0L, true); public final static SQLColumn<String> ACCESS_TOKEN = new StringColumn("ACCESS_TOKEN", true, null, 250); public final static SQLColumn<String> REFRESH_TOKEN = new StringColumn("REFRESH_TOKEN", true, null, 250); public LoginManager(DatabaseConnector connector) { super(connector, "LOGIN"); }}
@slender thistle this
Config file to define it
wait what
use JDBC
it's way better
JDBC 4.0 Introduction - Learning JDBC in simple and easy steps using this beginner's tutorial containing basic to advanced knowledge of JDBC including Drivers, Environment Setup, SQL Statement, Insert, Update, Select, Delete, Group By, Where Clause, Pagination, Result Sets, D...
how long does it take to get a response of a bot review
Donkkuuuu, you buys atm?
well, any bot developer free atm to take a look at a code for me please?
- What programming language
- What exactly do you need help with
- Are you getting any errors
@woeful flare just ask
what do i change to make it so theres only one listener?
const client = new Discord.Client()
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`)
})
client.on('message', msg => {
if (msg.content.toLowerCase().includes('Test'.toLowerCase())) {
msg.reply('Quiz')
}
})
client.on('message', msg => {
if (msg.content.toLowerCase().includes('Test'.toLowerCase())) {
msg.reply('Quiz')
}
})
client.login```
there, that one
i tried quite a few different formats but cant figure it out exactly
why there are 2 same thing
its a test, i just forgot to change the texts before i pasted it
use else if or if instead
if (msg .... "Test") {bla}
else if(msg ... "Kek") {bla2}
or just ifs
what do i remove to reduce the amount of listeners because i have over 100 things
its going to be a Q&A bot
just remove other client.on and keep 1 listener
const client = new Discord.Client()
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`)
})
client.on('message', msg => {
if (msg.content.toLowerCase().includes('Test'.toLowerCase())) {
msg.reply('Quiz')
}
})
('message', msg => {
if (msg.content.toLowerCase().includes('fire'.toLowerCase())) {
msg.reply('lookout')
}
})
client.login```
all i did was remove the client.on, the brackets are all still there from when it works
Your code is totally wrong
const client = new Discord.Client()
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`)
})
client.on('message', msg => {
if (msg.content.toLowerCase().includes('Test'.toLowerCase())) {
msg.reply('Quiz')
}
})
client.on('message', msg => {
if (msg.content.toLowerCase().includes('fire'.toLowerCase())) {
msg.reply('lookout')
}
})
client.login```
this is what it is right now, and it works just fine
const client = new Discord.Client()
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`)
})
client.on('message', msg => {
if (msg.content.toLowerCase().includes('Test'.toLowerCase())) {
msg.reply('Quiz')
}
if (msg.content.toLowerCase().includes('fire'.toLowerCase())) {
msg.reply('lookout')
}
})
client.login```
.login()
Try this
kk
Yup
And please end statements with a ; 
im doing just as the tutorials say to do it
I never use ;
The tutorial is teaching you bad practises then
from what ive seen so far, its teaching me to make a ton of listeners and still have everything work otherwise
It won't allow you to keep adding listeners
overexplaining things so to say in a sense
Yup
i know, thats why im here asking for help lol
And doing that just doesn't make sense
One listeners is ok
i couldnt find anywhere on how to remove the extra listeners and have it still work
thank you again GOD
The message listener will be fired once for every message, so you just put all code you want to run for each message in there.
i understand
Are you using an ide
a what?
What do you write your code in
atom
@woeful flare put if(msg.author.bot) return in your code
Good enough
where should i put that Lemaaa?
Under client.on(message
so before i start the "if"?
Why to add that
Yes
kk
Bc the bot can be kicked from dbl
If you dont put that
"Bot responds to other bot"
Then he should define author
you should never allow other bots to trigger your commands
Author are already define in d.js
You shouldn't do it just because dbl tells you to^^
oh, thats something i was going to figure out too, how do i prevent it from listening to other bots?
ah, so thats what that does
Yeah
Lemaaa
i see, now i understand why it spammed earlier, i had left the trigger and response blank, and since it was listening to bots at the time, it triggered itself?
But I have to give role id
Ahh
You can try by name and get the role id with the name
I can show you my code
If you want
Show
Idk how case work
Really idk why its not working, i think its the filter
Anyone know why those inoremaps aren't working properly? (last 3 lines)
Can you paste the lines here so i can read em on phone? Just do a visual line and "+y to copy to clipboard
@opaque eagle what programming language is that
Vim config
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'morhetz/gruvbox'
Plugin 'scrooloose/nerdtree'
Plugin 'vim-airline/vim-airline'
Plugin 'mattn/emmet-vim'
Plugin 'valloric/youcompleteme'
call vundle#end()
filetype plugin indent on
syntax on
colorscheme gruvbox
set background=dark
let g:airline_powerline_fonts = 1
set number
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab
inoremap {<cr> {<cr>}<c-o><s-o>
inoremap (<cr> (<cr>)<c-o><s-o>
inoremap [<cr> [<cr>]<c-o><s-o>```
I dont think {<cr> is valid. Are you trying to close brackets and stuff?
Yeah
You can just use the plugin jiangmiao/auto-pairs
It has a few other cool features as well
Yeah im 90% sure that {<cr> isnt valid
It used to work before for some reason
Huh
Can someone help me with procfile?
How often should i upload stats to dbl, if I'm posting to the end point directly? Is once per two minutes too much or too little?
The ratelimits is 60 per min right
Oh ok
dbalpi.js and dblpy autoposters both post guild count once per 30 mins
Ahh
git push -u origin master
Username for 'https://github.com': VinxVinxDev
Password for 'https://VinxVinxDev@github.com':
warning: Cannot protect .git/config on this file system - do not store sensitive information here.
Branch 'master' set up to track remote branch 'master' from 'origin'.
Everything up-to-date
$
its not want to update my changes
How do I do that?
It takes some time
Have you commited
yes,
Lmao I'm the dumbest ever... it did insert the closing bracket, but I didn't notice it cuz my cursor was on it lmao @mossy vine
do git status
ok
On branch master
Your branch is up to date with 'origin/master'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: index.html
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: index.html
@opaque eagle oof
The second modified is in red
@lilac geyser
Hi have this
error: failed to push some refs to 'https://github.com/VinxVinxDev/theking.github.io'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
How do I do??
Oh
I suggest you stash it first
Then git pull
Then resolve the conflicts
Yeah
bot.on('message', msg => { if(msg.content.startsWith(prefix+"reaction")){ if(!msg.channel.guild) return; for(let n in emojiname){ var emoji =[msg.guild.emojis.find(r => r.name == emojiname[n])]; for(let i in emoji){ msg.react(emoji[i]); } }}}); bot.on("messageReactionAdd",(reaction,user)=>{ if(!user) return; if(user.bot)return; if(!reaction.message.channel.guild) return; for(let n in emojiname){ if(reaction.emoji.name == emojiname[n]){ let role = reaction.message.guild.roles.find(r => r.name == rolename[n]); reaction.message.guild.member(user).addRole(role).catch(console.error); }}}); bot.on("messageReactionRemove",(reaction,user)=>{ if(!user) return; if(user.bot)return; if(!reaction.message.channel.guild) return; for(let n in emojiname){ if(reaction.emoji.name == emojiname[n]){ let role = reaction.message.guild.roles.find(r => r.name == rolename[n]); reaction.message.guild.member(user).removeRole(role).catch(console.error); } }});
Lol
first of all, fix that damn code what the fuck am i even looking at
Sorry
holy crap i've never seen such bad indenting
second of all, is there an issue or are you just posting it for the lols xd
theres no fucking indenting there
its just a mess
and we are supposed to figure out whats going on in that damn unreadable code that contains 3 event listeners
No err
what
i see
I can't see
anyone here works with python3 ?
What is emojiname @pallid zinc
Yes
@slender thistle you do?
If so, can you show me the raw data on how to setup welcome messages?
Lol
Welcome messages?
Yes
Use on_member_join event
On a user join>Check if it's your server > Send message, etc
alright
Store a channel in database to which you will post a message
Is it possible to set the welcome channel customizable with a command? ( using server variable )
Ex c!setup welcome [welcome channel]
Yeh
@pallid zinc for in is used to iterate over object properties?
Does it even do anything when you're using it on an array
Yes
..?
Are you using commands extension, Sandra?
^
You probably meant to use for of
Other than that your var emoji is an array with just one object.. why?
You would write to a text file, store the channel, (with a \n before or after) and look through that with:
f=open("welcome.txt","r")
channel_id = f.read()
f.close()
#Note: The Messagechannel object
#below is for what you use for the
server's channel.
if channel_id in Messagechannel:
###code###
For the on_user_join
For the command, you would write the message.channel into a welcome.txt file like:
f=open("welcome.txt, "r+")
f.write("\n"+message.channel)#use the \n for breaking, due to iDs possibly merging.#
f.close()
@fallow steppe
You would have to create the .txt file in the file explorer in the same directory obviously
how do i get developer role?
Have at least one approved bot on the site.
...
bruuuh
I come back from my business to someone suggesting text files as database
This is the site I just made with Github pages :
https://vinxvinxdev.github.io/TheKing/
Now how I do so that links are indicated as links and not as texts
<a href="link">this is a super cool link</a>
thx
Says the one who probably doesn't know about context managers in python, names a file f (f-strings in py3.6) and suggests text file as a database
css itself is easy but no matter what the fuck you do nothing will make sense
A bad one, I would say
If it works it works.
Sure, if it barely works or works only sometimes, it's good
However, concating a TextChannel to a string is an error my fam
@fallow steppe for d.py bots, asyncpg is the best since it's async.
If your bot is small, you can use sqlite/pymongo FOR NOW (though I really recommend using PostgreSQL with asyncpg).
mongodb has an async python driver named Motor, you might wanna check it out.
Back to the question about actually saving the channel.
Since you are using on_message, I would recommend using message.content.split to get the arg/args. At this point, I would make sure the channel actually exists, hence, another question. What is your discord.py version?
Likely 0.16.12 if it's still async
Mind elaborating on that "if it's still async" part?
Async was discontinued after 0.16.12
I'm not talking about the branch in any of my messages
How many people still haven't migrated to 1.1.0+,I wonder...
how do you create a command with a mention arg (only 1)
I tried to search it
but yah it required mention, but it didn't pass the events when it had a mention
client.on('message', message => {
if (message.content === 's!fight') {
if (fs.existsSync('data\\coins\\' + message.author.id + '.txt')) {
return message.channel.send('Please mention a user if you want to fight someone.');
const taggedUser = message.mentions.users.first();
if (message.author.presence.status = "online") {
if (taggedUser.presence.status = "online") {
message.channel.send('This is a test for now.')
} else {
message.channel.send("Sorry, but the mentioned player must have **ONLINE** status.")
}
} else {
message.channel.send("Sorry, but you must have **ONLINE** status.")
}
} else {
message.channel.send("Sorry, but you haven't started the game yet.")
}
}
});
code
it's impossible to check for arg when your command parser explicitly ignores messages that aren't s!fight
replace the js if (message.content === 's!fight') with ```js
if (message.content.startsWith('s!fight'))
afterwards ```js
message.content.split()[1]
should be the first argument
@west spoke I asked for python3 code, not other languages
That technically was py3
@slender thistle 3.7.1
Alright I was asking for d.py version but ig that works too
Tbh you would need a custom complicated channel converter for this and it would be easier if you used commands ext rn
How i can make this ?
if i have a class, and in its constructor i define a promise. can i resolve/reject that promise from another function in the class?
how mach time i need to wait to aproavel my bot ?
@fallow steppe I was talking about python3
0.16.12 is the latest discord.py async version
Honestly, do you know that 1.2.0 exists
How is that related
idk
(Just in case, "rewrite" is 1.0.0-1.0.1)
@lofty hamlet for(var i in `fichierdresseur`) { }
I think is that
Just remove the `
except for let instead of for var
Hi
no offense but your name sounds like one of those scam ads on youtube
No offense but if you don't need any help with any coding/programming, please leave this channel alone, it contains enough weird shit already
Ok
I got a fork bomb killing my pc, can't stop it
Have u tried restarting?
Anyways I have a question... if your cli git email is set to "foo@example.com" and u push it to a GitHub account with the checkbox for keeping ur email private checked on, is there any way ppl can find out "foo@example.com"?
How I can edit an embed?
same as you edit the content
simply set a new embed object that will replace the current embed
msg.edit({ embed: { title: "Edited" } })```
Guys how can i add role per reaction python?
but when I do to the site https://vinxvinxdev.github.io/TheKing/
He send me of theking.tk
How can i do ?
I cannot contact my DNS
when theres a reaction added
check for reaction name
add role to user that added the reaction
@earnest phoenix where did you get the domain?
im sure its in the discord.py docs
Thanks i understand
I just put it like this to look at, then I removed and I handed the Basic (github.io) but its always sends me back to the tk adress
No, I just want to go back to the basic domain
is that you can go to this site you?
https://vinxvinxdev.github.io/TheKing
or just press ctrl+shift+r
what are the most significant differnces between java and kotlin for android development?
How do I change the color for the vote count display
And yes, I know how to change the theme
Anyone
Nvm, changed the background instead
how do you send a bots presence to watching in discord.js? (ping)
ty
it's only guaranteed that the same message id can't be in the same channel
thanks
ayyy how to make command handler in python
in python bot
Wats a cmd handler
dont you know what command handler is
so u have all the code in one file
Yep
thats why i hate python bots
lol i would rather stay a discord.js bot developer then
@earnest phoenix has joined the chat
lmao
is that your bot
Yea
@earnest phoenix has joined the chat
I made the most op update a few weeks ago
lol im waiting them to review my new bot
Oof
so i can add updates without crashing it
i waiting its been like 4 days
It's been a few days for me
wow
i added mine last tuesday
Oof
yee
oof
i can tell you are on phone
without looking at new thingy
phone thingy
Yea
lol because your first letter is caps
Lol
phones auto caps them
My keyboard
lol ik
Lets turn it off
lol
😂
but the file is in here
y u have prefix.js
also why there is a prefix.json and botsettings.json
can you get data from botsettings?
@celest spindle ../prefix.json
Try with three points or one
If its not working
And it should be work
ok
do you read the json file with fs or just do require()? @celest spindle
i use fs
fs.readFileSync()
did that
from discord.ext import commands
import json
async def is_guild_owner(ctx):
return ctx.author.id == ctx.guild.owner.id
class Prefix(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
@commands.check(is_guild_owner)
async def prefix(self, ctx, *, pre: str=None):
if not pre:
await ctx.send('Specify a prefix')
else:
with open(r"data/prefixes.json", 'r') as f:
prefixes = json.load(f)
prefixes[str(ctx.guild.id)] = pre
await ctx.send(f"New prefix is `{pre}`")
with open(r"data/prefixes.json", 'r') as f:
json.dump(prefixes, f, indent=4)
def setup(bot):
bot.add_cog(Prefix(bot))```
Error: extention 'prefix' could not be loaded` no reason why showed up
some suggestions?
fs is weird as fuck, you need to provide the path with
fs.readFileSync(`${__dirname}/../prefix.json`)
huh
I dont use path
fs are weird
so use ${__dirname} just to be safe
Me i use ../prefix.json and its working
you can just do require('../config.json')
He cant @mossy vine
why not?
Bots need restart to load the json files
oh hes using json as database
Yes
bad idea but whatever
Require is using for get a data from a files
and if he want to changes prefix with a command he need fs
For syncFile
But fs are weird
@celest spindle its working or you get the same error?
fs are very weird
Np
you'know you can just use ./ or?
no @earnest phoenix
kay
Not working every times
Ok maybe just in js den
Another error no clue why this doesn't work as it works in the main bot file
let prefix = prefixes[message.guild.id].prefixes;
let prefixes = JSON.parse(fs.readFileSync("./prefix.json"))
nvm found the problem
check if it has message.guild.id first
.<
@earnest phoenix still get the same rror
*error
even though the json files are not empty
and what is the error
its bc prefixes are used two times for only one line
change the let prefixes
like to "prefixess"
and do prefixess[message.guild.id].prefixes
you could also define it to default prefix (let) then read and if guild has set it changes prefix = ^
noice
nou





