#development

1 messages · Page 621 of 1

mossy vine
#

yeah, it shuold work then

topaz sphinx
#

Anyone here knows python

#

yesc

#

?

mossy vine
#

what

topaz sphinx
#

Vedal alt confirmed forsenE

mossy vine
#

likely not

#

whatever

topaz sphinx
#

ye tru

#

i need to find an alternative to the rubbish library discordbots has to offer

#

for python

#

voting

#

and user count

mossy vine
#

well, its quite simple and you could just make your own

topaz sphinx
#

i need to know how doe

mossy vine
#

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

topaz sphinx
#

i need to learn hm

fiery stream
#

Its ez

near ether
#

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

ruby dust
#

you can literally google what webhooks are, they are like reverse API

copper cradle
#

Lol

ruby dust
#

there are too many people that think that webhooks are a discord thing

copper cradle
#

lmfao

ruby dust
mossy vine
#

yes

bitter sundial
slender thistle
#

Isn't it sweet when people call your stuff rubbish but don't wanna leave actual feedback

mossy vine
#

yeah, it really is

slender thistle
#

@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

fiery stream
#

Ez

slender thistle
#

It would be even better if you didn't just say "its ez" without explaining or posting any helpful article/video

viral spade
#

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?

shy turret
#
    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.

mossy vine
#

i dont think data\123456789.txt is a valid path

shy turret
#

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

fiery stream
#

Ayy

#

I m getting trouble getting ads on my webpage

hybrid hedge
#

Which page

earnest phoenix
#

how can i add english option to my bot

#

ask it nicely

dusky marsh
#

^

fallow steppe
#

any chance someone helps me with the raw data to change the bot's status ( online, idle, dnd )

warm marsh
#

What lang?

#

@fallow steppe

fallow steppe
#

english

warm marsh
#

...

#

I mean what language are you coding your bot in?

fallow steppe
#

java script

warm marsh
#

Ok

#

You want to change your bot's status?

fallow steppe
#

yes

#

to online / idle or dnd

warm marsh
#

Yeah.

earnest phoenix
#

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?

warm marsh
#

Send the nickname as a string not a mention

#

or tag

earnest phoenix
#

so:

guild.owner.username
warm marsh
#

depends

earnest phoenix
#

here

    .addField("👤 __Propriétaire__ :", guild.owner, true)
warm marsh
#

ok

#

you want it to display his name not his mention?

earnest phoenix
#

yes

warm marsh
#

guild.owner.user.username

earnest phoenix
#

tjx

#

thx*

warm marsh
#

That should work.

earnest phoenix
#

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

warm marsh
#

message.author.username

earnest phoenix
#

^

#

@earnest phoenix message.guild.owner.tag

#

message.author.username is fonctionnaly

mossy vine
#

what

earnest phoenix
#

For the owner @earnest phoenix

#

Yes is fonctionnaly

amber fractal
#

Is that a word in any language?

earnest phoenix
#

What?

#

No just in english

amber fractal
#

fonctionnaly is not a word tho

#

Wait

earnest phoenix
#

Ik

amber fractal
#

What is your primary language tho

earnest phoenix
#

French

#

VinxVinx are french too

amber fractal
#

Ah cant help with that then rip, sorry

#

Well I can, but not in french mmLol

#

What did you need

earnest phoenix
#

Nothing, VinxVinx need help

#

s

chrome olive
#

@surreal wasp best dev, js god =))

light matrix
#

for discord bots js is good, but for general programming i prefer java or python

idle basalt
#

js is just lit

#

as long as you stick to triple equals that is

amber fractal
#

false

#

=== is unnecessary

vernal rivet
#

^^^^

opaque eagle
#

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.

vernal rivet
#

😅 I am making a bot, with a lot of json files for data, and J's didn't like it.

shy rose
#

the nicer the language (how badly you can break the os) the worse it is on ram single matter of how they work

opaque eagle
#

What r u using JSON files for?

vernal rivet
#

Making a Pokemon bot

opaque eagle
#

Yeah but what types of info do u store in those json files

shy rose
#

if you have access a database might be better

opaque eagle
#

^

vernal rivet
#

Player stuff and the Pokemon info that has been caught

opaque eagle
#

Yeah... that's a bad idea

shy rose
#

yeah look at something like mysql

vernal rivet
#

I was thinking doing database

opaque eagle
#

Imo SQLite is better for those who r just coming out of JSON land

shy rose
#

true

opaque eagle
#

Since it's also file-based

vernal rivet
#

Oh yes, json is good, but can't handle much.

opaque eagle
#

JSON isn't intended for that, that's the problem...

#

You can't write/read to it simultaneously

vernal rivet
#

Yes

shy rose
#

you cant read/write simultaneously on sqlite either

opaque eagle
#

Ikr but for practice it's good

#

So if two users send a message around the same time, it will error.

vernal rivet
#

Know time to watch how to connect to a SQL database with c#

shy rose
#

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

vernal rivet
#

Yea, I have to check to see what is good for c#

shy rose
#

support for both iirc is in it

opaque eagle
#

In JS, switching between SQLite and MySQL is as easy as replacing a single string tbh

shy rose
#

either is better than json though for what your doing

opaque eagle
#

Since most ppl already use a query builder like Sequelize

shy rose
#

@opaque eagle for most part
but if your doing more advanced queries its a bit more painful

vernal rivet
#

Yea, i was really was using json to check to make sure the logic I have for catching and selecting works

opaque eagle
#

ayeee marco nicknamed me to eslint ./node_modules/
So every time someone pings me they say that lmao

shy rose
#

@opaque eagle ../../

opaque eagle
#

Nooooo whyyyy ;(

#

ohhh

#

I see

vernal rivet
#

Both options should be free right?

shy rose
#

yeah

vernal rivet
#

That's good for me then 😅

shy rose
#

thats why they are both so popular lol

vernal rivet
#

Lol

shy rose
#

only popular db that costs afik is oracle but yeah dont need that

vernal rivet
#

Can I nest a db in another DB, like an array in an array?

shy rose
#

you can have multiple tables it think what your after?

#

each table has columns

its like a big multiple page excel document

vernal rivet
#

Well I have to have them separately then call on the the cell number?

shy rose
#

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

vernal rivet
#

Wait does it add new data in a new row and column

shy rose
#

its just like a big excel sheet

vernal rivet
#

Oh ok

shy rose
#

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

vernal rivet
#

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.

shy rose
#

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

vernal rivet
#

Am I not home at the moment, but I can try my best and show what it kinda of looks like

shy turret
#
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 ]

vernal rivet
#
{
'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
}

}
}
}
opaque eagle
#

Also... I notice that you lack a basic understanding of JS

vernal rivet
#

It's something similar to this

opaque eagle
#

= is not the same as ===

#

@shy turret

shy turret
#

what's the difference

opaque eagle
#

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...

vernal rivet
#

You don't need to use 3 = 2 works for checking if they equal

shy turret
#

eh I started javascript few days ago

opaque eagle
#

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)

shy turret
#

kinda learned a lot\

opaque eagle
#

It’s like trying to write a research paper without knowing grammar rules... gonna end badly.

vernal rivet
#

gets an a on that research paper

shy turret
#

xD

grim aspen
#

@opaque eagle it's like bowling two handed without learning, i would turn out a mess

lilac geyser
#

It's the sixth day since I applied for my bot :/
I remember it being really fast the last few times I applied. 😰

west spoke
#

It takes at most 2 weeks

west spoke
#

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

copper cradle
#

I guess

fallow steppe
#

What is the raw data to make the bot create a channel in a specified Category ID? ( lang = java script )

copper cradle
#

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

west spoke
#

^

fallow steppe
#

ok then

#

I mean running a command like s!createchannel [channel name] [category ID]

copper cradle
#

wrong message

#

lmfao

#

Lemme help

#

Well that's actually pretty basic

west spoke
#

Strip channel name, then use the ID and move it

copper cradle
#
message.guild.createChannel(args[0], 'text').then(channel => channel.setParent(args[1]))
message.channel.send("Done")
topaz sphinx
#

i need someone i could abuse to get my python code working with dbl

#

voting

#

cause i am seriously stuck

balmy lantern
#

@topaz sphinx ?

#

Like ping the crap out, get kicked n banned in the face

#

Wdym

#

Ping pls

west spoke
#

@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")

copper cradle
#

@west spoke ok

west spoke
#

I just didn't have access to my computer yet

topaz sphinx
#

@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

pallid zinc
#

bot.on("member", async (member) => {if(member.bot){member.addRole('579514182441893899')} })

#

no err

copper cradle
#

that's not an event

#

the event you're looking for is

#

guildMemberAdd

#

@pallid zinc

pallid zinc
#

ok

#

thanks

copper cradle
#

np

pallid zinc
#

it dont work

copper cradle
#

send code

#

@pallid zinc

pallid zinc
#
bot.on("guildMemberAdd", async (member) => {if(member.bot){member.addRole('579514182441893899')} })
copper cradle
#
bot.on("guildMemberAdd", async (member) => {
if(member.bot) { 
member.addRole('579514182441893899');
}
});
#

what's the error

pallid zinc
#

no err

copper cradle
#

then it's working

#

are you adding a bot?

#

or a normal user?

#

to the server

pallid zinc
#

bot

shy rose
#

does a bot have a role thats above the one its giving

copper cradle
#

^

pallid zinc
#

yup

copper cradle
#

hmm

#

does the bot have admin perms?

pallid zinc
#

yup

copper cradle
#

send a pic of the thing

pallid zinc
#

what thing

copper cradle
#

the bot

#

and everything

pallid zinc
#

lol

#

WHICH PHOTO YOU WANT

copper cradle
#

both

#

@pallid zinc

#

first

#

I need to see ur code

#

and then the bot istelf

pallid zinc
#

bot.on("guildMemberAdd", async (member) => {if(member.bot){member.addRole('579514182441893899')} })

#

code

pallid zinc
#
      
   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;
      ```
woeful flare
#

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('')
  }
})```
vital nest
#

just convert their message to all lowercase

woeful flare
#

im new to coding

vital nest
#

ok, me too, let me find the right thing here 😃

#

give me an example of what the message the person would be typing

woeful flare
#

'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.

vital nest
#

give me a few mins im in the middle of a game ill help when its done 😃

woeful flare
#

ok thanks.

vital nest
#
  if (msg.content === '') {
    msg.reply('')
  }
})```
#

try that

woeful flare
#

will that make it so they can type it either way though?

vital nest
#

in theory as far as im aware

#

give it a shot though

woeful flare
#

ok ill check it out real quick.

#

nope, app crashes

vital nest
#

ok, let me finish this and ill help out, its not as simple as i was thinking

woeful flare
#

ok, thanks, ill be back in 5, steppen outside

vital nest
#

ok

pallid zinc
#

Lol

woeful flare
#

im back

pallid zinc
#
  if (msg.content.toLowerCase('')) {
    msg.reply('')
  } 
})```
#

Try

#

@woeful flare

vital nest
#

so I was on the right track?

woeful flare
#

well, it works, well, with the simple part about it repeating the response every second now lol

#

had to reset it

pallid zinc
#
      
  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

prime cliff
#

Wtf why spaces everywhere AHHHHHH

pallid zinc
#

Leave space bro

#

I don't know why my pc make space

#

It give this result

vital nest
#

any idea why my bot isnt responding in the testing channels? does it need to be approved first?

pallid zinc
#

Nope

earnest phoenix
#

@pallid zinc what do you want exactly?

pallid zinc
#

Prefix?

vital nest
#

i use !

pallid zinc
#

I want to role everyone @earnest phoenix

earnest phoenix
#

@vital nest the bot need to be here

pallid zinc
#

Yup

earnest phoenix
#

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
#

Ohh

#

Yup

vital nest
#

ok, so I need to wait for it to be approved and then it will join the server?

earnest phoenix
#

@vital nest yes

pallid zinc
#

And I have "s" there

earnest phoenix
#

Yes i see

#

Its good? @pallid zinc

pallid zinc
#

Let me check

woeful flare
#

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.
earnest phoenix
#

What?

vital nest
#

add a break

earnest phoenix
#

You need to put something in string

#

@woeful flare The bot spam?

pallid zinc
#

Remove .toLowerCase

woeful flare
#

i removed everything in that mention completely

#

i need it to not be case sensative

earnest phoenix
#

What do you want rogue?

pallid zinc
#

Lemaaa still same

vital nest
#

rougue send the code for the entire command

woeful flare
#

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.
earnest phoenix
#

@pallid zinc args[0].toLowerCase

pallid zinc
#

Ok

woeful flare
#
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

earnest phoenix
#

if(msg.author.bot) return

#

@woeful flare

vital nest
#

take out the quotes in the parenthesis after the to lower case

pallid zinc
#

Why to put toLowercase

earnest phoenix
#

@pallid zinc if you put a maj

#

Caps*

#

In the args

pallid zinc
#

Not asking to you

earnest phoenix
#

like "aDmIN"

#

Oh okay

pallid zinc
#

Saying to @woeful flare

woeful flare
#

the apostraphes are for the message, i just havent put it in yet

vital nest
#

you dont have an equals statement

pallid zinc
#

Still

vital nest
#

so everytime a message is sent it will send it again

woeful flare
#

it only repeats the send if i put in the command the way GOD said to put it.

vital nest
#
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

earnest phoenix
#

Wth

pallid zinc
#

@woeful flare then I say to remove

#

Plzz remove it

woeful flare
#

i did

vital nest
#

where "string goes here" is put your question

earnest phoenix
#

@woeful flare what do you want?

vital nest
#

he is making a command that will respond to a question

earnest phoenix
#

Oh

vital nest
#

like What is the date today

#

but wants it do that no matter how someone types it with caps or not it will work

woeful flare
#

ok, ill start from the begining

pallid zinc
#

Not working lemaaa

earnest phoenix
#

message.contents.startsWith('lul').toLowerCase

woeful flare
#

Im making a Q&A bot, i want it to not be case sensative.

vital nest
#

what happens when you put what i posted rouge

earnest phoenix
#

@pallid zinc no error?

pallid zinc
#

Wait telling

#

No err

late hill
#

put toLowerCase() before startsWith()

earnest phoenix
#

Wait 2m @pallid zinc

pallid zinc
#

Ok

#

message.content.toLowerCase() = "hello"

woeful flare
#

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

late hill
#

That doesn't even make sense

pallid zinc
#

I know

#

Just remove tolowercase

#

No need of it

earnest phoenix
#
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

late hill
#

Use one message listener @woeful flare

#

You don't need 2

woeful flare
#

and that means?

late hill
#

1 client.on("message" ..

vital nest
#
    // 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

late hill
#

And put if(msg.author.bot) return like lema said

#

To prevent the bot from replying to itself / other bots

vital nest
#

i use discord.io so things are different if you are using discord.js module

woeful flare
#

so i remove

})
client.on('message', msg => {``` 
the second time i have it typed?
late hill
#

Yes

woeful flare
#

k

late hill
#

You can just move the code you have in the second one to the first one

woeful flare
#

so back to the main thing im trying to figure out, how do i make it so its not case sensative?

late hill
#

Convert the entire thing to lowercase / uppercase

#

Whichever you prefer

woeful flare
#

ok i give up

#

have fun guys,

late hill
#

😂

earnest phoenix
#
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<<< ')

late hill
#

Just googling javascript convert string to lowercase/uppercase would work 🤷

#

And lema bruh

#

No

earnest phoenix
#

idk if toLowerCase is before or after

late hill
#

toLowerCase() before

#

Or else you're calling it on a boolean

#

Which isn't a thing

pallid zinc
#

Lemaaa still same

earnest phoenix
#

really? @pallid zinc

#

wait

#

you have delete let args ?

pallid zinc
#

Yup

earnest phoenix
#

dont delete it x)

pallid zinc
#

Sorry did delete

earnest phoenix
#

args[0] doesn't work for find a role

pallid zinc
#

Ohh I deleted

earnest phoenix
#

copy pasta what i said, and it should be work

pallid zinc
#

It's not working

earnest phoenix
#

Nice

#

ah

pallid zinc
#

Sorry want to say not

earnest phoenix
#

why you filter member ?

pallid zinc
#

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;

earnest phoenix
#

delete break

pallid zinc
#

I don't want to role bots

earnest phoenix
#

and remplace case by let

pallid zinc
#

Ok

earnest phoenix
#

and wth

pallid zinc
#

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

earnest phoenix
#

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 ^

pallid zinc
#

It is same

earnest phoenix
#

no

pallid zinc
#

If I don't put case: "role"

idle basalt
#

have you heard of indentation

pallid zinc
#

How can executed it

earnest phoenix
#

@pallid zinc Ahhh

pallid zinc
#

What

earnest phoenix
#

```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

pallid zinc
#

What I sad

earnest phoenix
#

and not work ?

#

whats the bot send in the channel?

pallid zinc
#

Should I add else if

earnest phoenix
#

you are sure you put a correct name ?

#

ohhh

#

you want to do it by ping

pallid zinc
#

Ok

#

I just want to do now

earnest phoenix
#

@pallid zinc try -role name

pallid zinc
#

Same

woeful flare
#

i figured it out.....

#
  if (msg.content.toLowerCase().includes('Test'.toLowerCase())) {
    msg.reply('Quiz')
  }```
#

and its case-insensitive

earnest phoenix
#

Working? @woeful flare

woeful flare
#

it is now

#

thanks for trying to help

earnest phoenix
#

Np

pallid zinc
#

@earnest phoenix still not working

#

@earnest phoenix fixed it

#

I need to give role id

#

To work

plucky peak
#

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

kind wyvern
#

How I define a SQL database?

late hill
#

Create the reactionCollector on the message sent by your bot

#

By using .then() on your message send or by using await on it

kind wyvern
#

U saying me?

late hill
#

Not you

kind wyvern
#

Ok

late hill
#

@plucky peak ^^

slender thistle
#

Define an SQL database?..

late hill
#

You already use .then() on it to add the reactions

#

So just put the reactionCollector in there too

slender thistle
#

What's your programming language, Sunny

kind wyvern
#

Java @slender thistle

#

Sry for ping

plucky peak
#

Hm

slender thistle
#

I would like it if you told me exactly which database you would like to use

kind wyvern
#

Sql

slender thistle
#

SQL is not a db

kind wyvern
#

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

spring ember
#

wait what

#

use JDBC

#

it's way better

#
earnest phoenix
#

how long does it take to get a response of a bot review

woeful flare
#

Donkkuuuu, you buys atm?

#

well, any bot developer free atm to take a look at a code for me please?

slender thistle
#
  1. What programming language
  2. What exactly do you need help with
  3. Are you getting any errors
pallid zinc
#

@woeful flare just ask

woeful flare
#

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

earnest phoenix
#

why there are 2 same thing

woeful flare
#

its a test, i just forgot to change the texts before i pasted it

earnest phoenix
#

use else if or if instead

#

if (msg .... "Test") {bla}
else if(msg ... "Kek") {bla2}

#

or just ifs

woeful flare
#

what do i remove to reduce the amount of listeners because i have over 100 things

#

its going to be a Q&A bot

earnest phoenix
#

just remove other client.on and keep 1 listener

woeful flare
#

k

#

that crashed it

pallid zinc
#

Lol

#

@woeful flare show code

#
  • err
woeful flare
#
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```
pallid zinc
#

One extra ) or you need one more @woeful flare

#

Ohh sorry

woeful flare
#

all i did was remove the client.on, the brackets are all still there from when it works

pallid zinc
#

Your code is totally wrong

woeful flare
#
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
pallid zinc
#
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```
late hill
#

.login()

pallid zinc
#

Try this

woeful flare
#

kk

pallid zinc
#

Yup

late hill
#

And please end statements with a ; wearybread

pallid zinc
#

Lol

#

No need

woeful flare
#

im doing just as the tutorials say to do it

pallid zinc
#

I never use ;

late hill
#

The tutorial is teaching you bad practises then

woeful flare
#

from what ive seen so far, its teaching me to make a ton of listeners and still have everything work otherwise

late hill
#

It won't allow you to keep adding listeners

woeful flare
#

overexplaining things so to say in a sense

pallid zinc
#

Yup

woeful flare
#

i know, thats why im here asking for help lol

late hill
#

And doing that just doesn't make sense

pallid zinc
#

One listeners is ok

woeful flare
#

i couldnt find anywhere on how to remove the extra listeners and have it still work

#

thank you again GOD

late hill
#

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.

woeful flare
#

i understand

late hill
#

Are you using an ide

woeful flare
#

a what?

late hill
#

What do you write your code in

woeful flare
#

atom

earnest phoenix
#

@woeful flare put if(msg.author.bot) return in your code

late hill
#

Good enough

woeful flare
#

where should i put that Lemaaa?

earnest phoenix
#

Under client.on(message

late hill
#

And yes

#

Usualy as first line

#

In the event

woeful flare
#

so before i start the "if"?

pallid zinc
#

Why to add that

earnest phoenix
#

Yes

woeful flare
#

kk

earnest phoenix
#

Bc the bot can be kicked from dbl

#

If you dont put that

#

"Bot responds to other bot"

pallid zinc
#

Then he should define author

earnest phoenix
#

you should never allow other bots to trigger your commands

#

Author are already define in d.js

late hill
#

You shouldn't do it just because dbl tells you to^^

woeful flare
#

oh, thats something i was going to figure out too, how do i prevent it from listening to other bots?

earnest phoenix
#

if(msg.author.bot) return;

woeful flare
#

ah, so thats what that does

earnest phoenix
#

Yeah

pallid zinc
#

Lemaaa

woeful flare
#

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?

earnest phoenix
#

Yes?

#

@pallid zinc?

pallid zinc
#

Ok I got it

#

And I fix my code

earnest phoenix
#

Oh okay

#

And it was what

pallid zinc
#

But I have to give role id

earnest phoenix
#

Ahh

#

You can try by name and get the role id with the name

#

I can show you my code

#

If you want

pallid zinc
#

Show

earnest phoenix
pallid zinc
#

Ok

#

My command

earnest phoenix
#

Idk how case work

pallid zinc
#

Lol

#

See the main think

#

Plzz check it @earnest phoenix

earnest phoenix
#

Really idk why its not working, i think its the filter

pallid zinc
#

Lol

#

But thanks a lot

opaque eagle
#

Anyone know why those inoremaps aren't working properly? (last 3 lines)

mossy vine
#

Can you paste the lines here so i can read em on phone? Just do a visual line and "+y to copy to clipboard

spring ember
#

@opaque eagle what programming language is that

mossy vine
#

Vim config

opaque eagle
#
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>```
mossy vine
#

I dont think {<cr> is valid. Are you trying to close brackets and stuff?

opaque eagle
#

Yeah

mossy vine
#

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

opaque eagle
#

It used to work before for some reason

mossy vine
#

Huh

kind wyvern
#

Can someone help me with procfile?

lilac geyser
#

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

slender thistle
#

Once per 30 mins usually

#

You are correct about the ratelimit

lilac geyser
#

Oh ok

slender thistle
#

dbalpi.js and dblpy autoposters both post guild count once per 30 mins

lilac geyser
#

Ahh

earnest phoenix
#
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?

spring ember
#

It takes some time

earnest phoenix
#

How many?

#

@spring ember

#

Do I do it by hand at the worst?

#

it's good

lilac geyser
#

Have you commited

earnest phoenix
#

yes,

opaque eagle
#

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

lilac geyser
#

do git status

earnest phoenix
#

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
mossy vine
#

@opaque eagle oof

earnest phoenix
#

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??

lilac geyser
#

Oh

#

I suggest you stash it first

#

Then git pull

#

Then resolve the conflicts

#

Yeah

pallid zinc
#

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

mossy vine
#

first of all, fix that damn code what the fuck am i even looking at

pallid zinc
#

Sorry

grim aspen
#

holy crap i've never seen such bad indenting

mossy vine
#

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

pallid zinc
#

There is no err

#

But not working

grim aspen
#

first off

#

that code's a fucking mess

mossy vine
#

and we are supposed to figure out whats going on in that damn unreadable code that contains 3 event listeners

pallid zinc
#

Wait

#

Don't see it

#

And forget

#

About it

grim aspen
#

we aren't forgetting

#

first fix that code please

grim aspen
#

better

#

@mossy vine

pallid zinc
#

No err

mossy vine
#

what

grim aspen
#

he fixed the code at least

#

using pastebin

mossy vine
#

i see

unique nimbus
#

I can't see

pallid zinc
#

Lol

#

Can you check?

fallow steppe
#

anyone here works with python3 ?

late hill
#

What is emojiname @pallid zinc

slender thistle
#

Yes

fallow steppe
#

@slender thistle you do?

#

If so, can you show me the raw data on how to setup welcome messages?

pallid zinc
#
  var rolename=["",""];```
#

Do you get what it is

slender thistle
#

Yes

#

@fallow steppe

pallid zinc
#

Lol

slender thistle
#

Welcome messages?

fallow steppe
#

Yes

slender thistle
#

Use on_member_join event

west spoke
#

On a user join>Check if it's your server > Send message, etc

fallow steppe
#

alright

slender thistle
#

Store a channel in database to which you will post a message

fallow steppe
#

Is it possible to set the welcome channel customizable with a command? ( using server variable )

#

Ex c!setup welcome [welcome channel]

west spoke
#

Yeh

late hill
#

@pallid zinc for in is used to iterate over object properties?

#

Does it even do anything when you're using it on an array

slender thistle
#

Yes

late hill
#

..?

slender thistle
#

Are you using commands extension, Sandra?

pallid zinc
#

^

late hill
#

You probably meant to use for of

fallow steppe
#

@slender thistle nope

#

Ping back when replying

late hill
#

Other than that your var emoji is an array with just one object.. why?

west spoke
#

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

crude tide
#

how do i get developer role?

late hill
#

Have at least one approved bot on the site.

slender thistle
#

...

west spoke
#

bruuuh

slender thistle
#

I come back from my business to someone suggesting text files as database

earnest phoenix
mossy vine
#

<a href="link">this is a super cool link</a>

earnest phoenix
#

thx

west spoke
#

:v

#

Learn html lol

slender thistle
#

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

shy turret
#

html is ez

#

xd

#

css i dont know

mossy vine
#

css itself is easy but no matter what the fuck you do nothing will make sense

slender thistle
#

Wait wtf I see '\n' + message.channel

#

My eyes are about to bleed rn ngl

west spoke
#

It's a example..

#

Jesus Christ give me a break

slender thistle
#

A bad one, I would say

west spoke
#

If it works it works.

slender thistle
#

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?

west spoke
#

Likely 0.16.12 if it's still async

slender thistle
#

Mind elaborating on that "if it's still async" part?

west spoke
#

Async was discontinued after 0.16.12

slender thistle
#

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...

shy turret
#

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

spring ember
#

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
fallow steppe
#

@west spoke I asked for python3 code, not other languages

slender thistle
#

That technically was py3

fallow steppe
#

@slender thistle 3.7.1

slender thistle
#

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

lofty hamlet
#

How i can make this ?

mossy vine
#

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?

spice pivot
#

how mach time i need to wait to aproavel my bot ?

west spoke
#

@fallow steppe I was talking about python3

slender thistle
#

Honestly, do you know that 1.2.0 exists

west spoke
#

That's rewrite

#

I'm talking about the old one :v

slender thistle
#

How is that related

west spoke
#

idk

slender thistle
#

(Just in case, "rewrite" is 1.0.0-1.0.1)

earnest phoenix
#

@lofty hamlet for(var i in `fichierdresseur`) { }

#

I think is that

#

Just remove the `

spring ember
#

except for let instead of for var

tawdry bough
#

Hi

mossy vine
#

no offense but your name sounds like one of those scam ads on youtube

tawdry bough
#

No

#

I just like to play these games

#

I will change the name

slender thistle
#

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

tawdry bough
#

Ok

spring ember
#

I got a fork bomb killing my pc, can't stop it

opaque eagle
#

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"?

earnest phoenix
#

How I can edit an embed?

ruby dust
#

same as you edit the content

#

simply set a new embed object that will replace the current embed

mossy vine
#
msg.edit({ embed: { title: "Edited" } })```
crude tide
#

Guys how can i add role per reaction python?

earnest phoenix
mossy vine
#

add it to custom domain

#

add github ips to your dns

#

done

crude tide
#

Guys how can i add role per reaction python?

#

Or at least

#

The algo

earnest phoenix
#

I cannot contact my DNS

mossy vine
#

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?

crude tide
#

What

#

If

#

He raexted

#

To other

#

Message

#

With same reaction

mossy vine
#

stop line spamming

#

check for message id as well

#

an if statement does magic

crude tide
#

Can you send its docs?

#

Ohh

mossy vine
crude tide
#

Thanks i understand

earnest phoenix
#

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

mossy vine
#

are you sure its registered Thonk

earnest phoenix
#

No, I just want to go back to the basic domain

mossy vine
#

that site doesnt redirect me and shows me the right content

earnest phoenix
#

oh it's this

#

uh

#

I reload my computer

mossy vine
#

or just press ctrl+shift+r

earnest phoenix
#

it's good

#

Thank you for your help

slender thistle
#

@crude tide What's your d.py version

mossy vine
#

what are the most significant differnces between java and kotlin for android development?

cold canyon
#

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

short portal
#

how do you send a bots presence to watching in discord.js? (ping)

ruby dust
short portal
#

ty

viral spade
#

Are message ids unique accross servers?

#

for all time?

ruby dust
#

it's only guaranteed that the same message id can't be in the same channel

viral spade
#

thanks

crude tide
#

@slender thistle rewrite

#

I mean the last one

fiery stream
#

ayyy how to make command handler in python

cold canyon
#

?

#

Wats dat

fiery stream
#

in python bot

cold canyon
#

Wats a cmd handler

fiery stream
#

dont you know what command handler is

cold canyon
#

No

#

Or I might know

fiery stream
#

to sperate commands in different files

#

like commands/ping.py

cold canyon
#

Hmm

#

I didn't do cmd handlers for sending msgs

fiery stream
#

so u have all the code in one file

cold canyon
#

Yep

fiery stream
#

thats why i hate python bots

#

lol i would rather stay a discord.js bot developer then

cold canyon
#

@earnest phoenix has joined the chat

fiery stream
#

lmao

cold canyon
#

Sad that I can't use nv!say

#

Bcause it responds to an invalid cmd

fiery stream
#

is that your bot

cold canyon
#

Yea

fiery stream
#

@earnest phoenix has joined the chat

cold canyon
#

I made the most op update a few weeks ago

fiery stream
#

lol im waiting them to review my new bot

cold canyon
#

Oof

fiery stream
#

so i can add updates without crashing it

cold canyon
#

Mine got reviewed

#

49412 users

#

bOI

fiery stream
#

i waiting its been like 4 days

cold canyon
#

It's been a few days for me

fiery stream
#

wow

cold canyon
#

Or a week

#

Idk

#

I have to chexk

#

*check

fiery stream
#

i added mine last tuesday

cold canyon
#

Oof

fiery stream
#

yee

#

oof

#

i can tell you are on phone

#

without looking at new thingy

#

phone thingy

cold canyon
#

Yea

fiery stream
#

lol because your first letter is caps

cold canyon
#

Lol

fiery stream
#

phones auto caps them

cold canyon
#

My keyboard

fiery stream
#

lol ik

cold canyon
#

Lets turn it off

fiery stream
#

lol

cold canyon
#

nah let's keep it on

#

Much better

fiery stream
#

😂

cold canyon
#

When I'm on Mac, I don't give a fuck

#

But on mobile, I keep it on

fiery stream
#

lol

#

-_-

#

@_@ lol

cold canyon
#

Lel

#

)_(

fiery stream
#

lmao

#

😄

#

;D

celest spindle
earnest phoenix
#

use one dot

#

./prefix.json

#

double dot directs you to upper folder

celest spindle
earnest phoenix
#

y u have prefix.js

celest spindle
#

thats the name of the file thats runs that

#

should I change ti?

#

*it?

earnest phoenix
#

also why there is a prefix.json and botsettings.json

#

can you get data from botsettings?

celest spindle
#

yea,

#

I use prefix.json for the prefixes of other guilds

earnest phoenix
#

@celest spindle ../prefix.json

#

Try with three points or one

#

If its not working

#

And it should be work

celest spindle
#

ok

earnest phoenix
#

one dot search the file in current folder tho

#

dunno about 3 dots

mossy vine
#

do you read the json file with fs or just do require()? @celest spindle

celest spindle
#

i use fs

earnest phoenix
#

fs.readFileSync()

celest spindle
#

did that

trail dagger
#
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?
mossy vine
#

fs is weird as fuck, you need to provide the path with
fs.readFileSync(`${__dirname}/../prefix.json`)

celest spindle
#

huh

earnest phoenix
#

I dont use path

mossy vine
#

sometimes fs starts to read from root directory of the project

#

sometimes

#

its weird

earnest phoenix
#

fs are weird

mossy vine
#

so use ${__dirname} just to be safe

celest spindle
#

is there any alternative to fs?

#

or no

earnest phoenix
#

Me i use ../prefix.json and its working

mossy vine
#

you can just do require('../config.json')

celest spindle
#

hm

#

ok

earnest phoenix
#

He cant @mossy vine

mossy vine
#

why not?

earnest phoenix
#

Bots need restart to load the json files

mossy vine
#

oh hes using json as database

earnest phoenix
#

Yes

mossy vine
#

bad idea but whatever

earnest phoenix
#

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?

celest spindle
#

i just used ${__dirname} and it worked

#

thanks for the help

#

both of you

earnest phoenix
#

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

celest spindle
#

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"))

earnest phoenix
#

change let @celest spindle

#

nah

celest spindle
#

nvm found the problem

earnest phoenix
#

boi

#

or check if your json file are empty

celest spindle
#

me being an idiot

#

i defined it as a constant in one of the files

earnest phoenix
celest spindle
#

.<

earnest phoenix
#

ooooh

#

:3

#

@earnest phoenix marry me

#

nou

celest spindle
#

@earnest phoenix still get the same rror

#

*error

#

even though the json files are not empty

earnest phoenix
#

and what is the error

celest spindle
earnest phoenix
#

its bc prefixes are used two times for only one line

#

change the let prefixes

#

like to "prefixess"

celest spindle
#

ah

#

ok

earnest phoenix
#

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 = ^

celest spindle
#

kk

#

wait nevermind

#

figured it out

earnest phoenix
#

noice

gaunt blade
#

Jonny smart

#

😉

earnest phoenix
#

nou

gaunt blade
#

Lol wut

#

u r smart..

earnest phoenix
#

Mystic r

#

:>

#

hmm

gaunt blade
#

we both are

#

:>

#

Me in Lua

#

You in JS

#

:>

earnest phoenix
#

XD

#

Coding bot in lua?

#

lua is for game no?

#

Lua got discord thing too