#development

1 messages · Page 438 of 1

keen drift
#

can you try utf8mb4

#

it's getting truncated

bold wigeon
#

someone?

keen drift
#

I'd say make sure your path is correct

#

not really a python guy

bold wigeon
#

what will happend if ill delete line 7

keen drift
#

u want me to count lines or something

#

is that the chalk line

tawdry fox
#

uft8mb4_bin, uft8mb4_unicode_520_ci or uft8mb4_unicode_ci?

keen drift
#

uft8mb4_unicode_ci

tawdry fox
#

ok

keen drift
#

also make sure your connection allows that charset

#

You may need to specify character encoding in jdbc connector

tawdry fox
#
try {
                Class.forName("com.mysql.jdbc.Driver");
                conn = DriverManager.getConnection("jdbc:mysql://localhost/Ferchy", "Ferchy", "lol");
            } catch (Exception e) {
                e.printStackTrace();
            }
#

how

earnest phoenix
#

where can i see Discord's API?

#

like its classes and objects

keen drift
#

conn = DriverManager.getConnection("jdbc:mysql://localhost/Ferchy?characterEncoding=utf8mb4", "Ferchy", "lol");

bold wigeon
#

im trying to cd

keen drift
#

@earnest phoenix Which library

earnest phoenix
#

.Net

bold wigeon
#

E:\Users\Owner\AppData\Local\Programs\Python\Python36-32\Scripts

#

and i cant do it

hot sleet
earnest phoenix
#

One message removed from a suspended account.

keen drift
#

That's for DBL, not sure if he wants that

hot sleet
#

oh he said discord

#

wait

keen drift
#

Nuget doesn't pull definition files?

hot sleet
keen drift
earnest phoenix
#

oh yeah thank you @keen drift

bold wigeon
#

someone can help me😢 ?

#

there is 1k developers and nobody knows how to fix it?

hot sleet
keen drift
#

@bold wigeon It's hard when the tools fails

#

Last step would be a python reinstallation, but I'd ensure your pythonpath is correct

#

@hot sleet what part

#

you struggle with

hot sleet
#

i want to show members roles like this

bold wigeon
#

omgggggggggggggggggg

#

i fixed it!!!!!!!

#

woooooooooo

hot sleet
#

don't spam here

bold wigeon
#

sry

hot sleet
#

np

bold wigeon
#

can i show you the bot pls?

earnest phoenix
#

naw

#

jk

keen drift
#

@hot sleet But what part of are you confused by

#
{
  "embed": {
    "title": ":briefcase: Roles",
    "description": "Bot Developer, Hide NSFW"
  }
}
tawdry fox
#

fak xd

hot sleet
#

i mean something like message.author.roles

#

nvm about that

tawdry fox
#
                conn = DriverManager.getConnection("jdbc:mysql://localhost/Ferchy?characterEncoding=utf8mb4", "Ferchy", "lol");
``` @keen drift  [ERROR] MySQL connection is null
keen drift
#

yikes jdbc picky

tawdry fox
#

what

keen drift
#

Welp ignore that one then

#

Just set it in your mysql config

#

jdbc doesn't like it

tawdry fox
#

how?

keen drift
#

find your mysql config

tawdry fox
#

ok

bold wigeon
keen drift
#

@tawdry fox no it's empty

tawdry fox
#

i only have that config file of mysql

keen drift
#

there should more folders 😛

earnest phoenix
#

One message removed from a suspended account.

tawdry fox
#

fail

keen drift
#

not that one either

#

do you have support with your host 😛

tawdry fox
#
#
# * Character sets
#
# MySQL/MariaDB default is Latin1, but in Debian we rather default to the full
# utf8 4-byte character set. See also client.cnf
#
character-set-server  = utf8mb4
collation-server      = utf8mb4_general_ci
keen drift
#

you have to set the default-character-set

#

for [client] and [mysql]

bold wigeon
tawdry fox
#

i set it to utf8_unicode_ci

keen drift
#

set it to utf8mb4 for connection

tawdry fox
#

ok

bold wigeon
#

???????

keen drift
#
[client]
default-character-set = utf8mb4

[mysql]
default-character-set = utf8mb4
#

@bold wigeon idk why don't you hover over it

bold wigeon
#

i cant turn on the bot

keen drift
#

h0ver over the err0r

bold wigeon
#

never maind

#

nvm

slender thistle
#

Because why the actual fuck do you have the same command defined twice

bold wigeon
#

found the problem

slender thistle
bold wigeon
#

fixed it

keen drift
knotty steeple
#

what language is that

#

looks like go

#

tbh

topaz fjord
#

that is go

knotty steeple
#

oh zoomeyes

keen drift
#

it's go

topaz fjord
#

@keen drift u use discordgo?

keen drift
#

yeah

#

I use js and go

topaz fjord
#

how is it

keen drift
#

f u n

topaz fjord
#

i cant stand go

keen drift
#

aside from the misleading doc, it's great

topaz fjord
#

im playing with it

#

i hate the way its structured

knotty steeple
#

i already tried go

keen drift
#

go is insanely fast

knotty steeple
#

and making a discord bot with it

topaz fjord
#

i will give u that tho

knotty steeple
#

it wouldnt log in 😩

#

idk why nothing was wrong with my token and i basically use example code from docs

keen drift
#

I like go

earnest phoenix
#

Idk what go is

topaz fjord
#

a lang

#

made by google

earnest phoenix
#

Oh

knotty steeple
#

its literally the first 2 letters of google

#

google

topaz fjord
#

well

#

the full name is golang

keen drift
#

it's around 50x faster than python

neat falcon
#

wew

topaz fjord
#

@keen drift i would stick with it if it had built in event emitting

keen drift
#

event

#

there are channels

topaz fjord
#

ik

#

but like something that can send and recieve

#

similar to .emit and .on in js

keen drift
#

it can send and receive?

#

lol

#

h u h

topaz fjord
#

im too lazy to do it

keen drift
#

func a(chan b) { dosomestuff then b<-stuff } func c(chan z) { x:= <-z}

#

bidirectional

inner jewel
#

"x is y% faster than z" heavily depends on what is being done

keen drift
#

compiled will always be faster

inner jewel
#

not really

#

good interpreted code can beat bad compiled code

#

and you need to consider development costs and maintainability

#

if there's really good library in python that does X

keen drift
#

in some cases it can

inner jewel
#

but none that does X for go

#

and X is complicated

keen drift
#

but compiler is meant to breakdown the scalfolds

inner jewel
#

it's most likely not worth it implementing in go

keen drift
#

reducing cost

inner jewel
#

compilers aren't magical either

#

they can optimize but only what they can infer

keen drift
#

which is pretty much everything for statically typed

inner jewel
#

no

#

code that can be easily optimized by a human who knows what it does might be extremely hard for a compiler to optimize

keen drift
#

so you are saying machinecode runs slower than a b type language

inner jewel
#

no

#

i'm saying that it depends on what the code does

#

it might not even be worth using machine code for eg IO bound applications

#

you'll spend more time waiting for IO to complete than actually using the cpu

keen drift
#

it depends

#

Different implementation obv yields different

#

I wouldn't go too deep into this, but at most cases, jit & others will perform better

#

not saying all

inner jewel
#

also you might want to trade performance for stability (eg elixir/erlang) or something like that

bold wigeon
#

how can i get key from youtube data?

keen drift
#

what key

bold wigeon
#

for music bot

keen drift
#

you don't need one?

bold wigeon
#

youtube imports

#

i talked with a developer and he told me that i need

inner jewel
#

you need if you use the official way

#

if you scrape (aka break youtube's terms) you don't need a key

#

but risk an ip ban

bold wigeon
#

can someone send me the full code

keen drift
#

There are plenty of music bots open sourced

bold wigeon
#

the leagal

earnest phoenix
#
Sondage
Question :thinking: ? :
Tu est pour qui ?  -r1 la France reponse -r2 l'Espagne -r3 l'arbitre
Réponse 1 :one: ! :
la France reponse -r2 l'Espagne -r3 l'arbitre
Réponse 2 :two: ! :
l'Espagne -r3 l'arbitre
Réponse 3 :three: ! :
l'arbitre
look
-r1 in question normality is not visible
#

you can help me ?

#

-r1 in question normality is not visible

#

-r2 a like -r3 ...

keen drift
#

not even sure what the code is designed to do

past pike
#

My logs says everytime: Missing permissions. What's wrong?

keen drift
#

mission permission GWfroggyJerry

earnest phoenix
#

just change you if.member.permission (ADMINISTATEUR)

#

i,

#

in

knotty steeple
#

wat

earnest phoenix
#

BAN_MEMBERS

#

this

#

if (!message.guild.member(message.author).hasPermission('ADMINISTRATOR'))

past pike
#

one problem. idk which command it is lol

earnest phoenix
#

you have just changa ADMINISTRATOR

keen drift
#

@bold wigeon I don't think there's an API for downloading video

earnest phoenix
#

in other permission

keen drift
#

@bold wigeon Since it's against their TOS like @inner jewel said, their API will not support it. So scraping is required.

knotty steeple
#

isnt hasPermission depreciated? Thonk

keen drift
#

You will have to scrape for the data

earnest phoenix
#

you can show you code ?

past pike
#

I?

earnest phoenix
#

what ?

past pike
#

I thought you asked my that question

#

because with Missing Permission log

earnest phoenix
#

yes

#

you can show you code missing permission

#

your permission code

past pike
#

give me a second

earnest phoenix
#

Np 😉

past pike
#

it's a level system

#

i think the logs comes from there

earnest phoenix
#

maybe is you sql bdd don't have a permission 🤔

#

because I don't see any javascript porblem permission

past pike
#

hmm okay

#

it does not crash the bot, but the logs fills a lot

#

should it help to add this:
if(!message.member.hasPermission("SEND_MESSAGES")) return;

#

I think that worked

#

no errors right now

earnest phoenix
#

yes or

#

BAN_MEMBERS

#

this is good to

past pike
#

nope get error

earnest phoenix
#

You have a error ?

past pike
#

now he says : TypeError: Cannot read property 'hasPermission' of null

earnest phoenix
#

if(!message.member.hasPermission("BAN_MEMBERS")) return message.channel.send("No can do pal!");

#

try with this

#

does anyone know how to implement the discord oauth strategy in a react+router (web based) application with the intent to retrieve the user's identity (excluding email)

past pike
#

okay

earnest phoenix
#

no lol @earnest phoenix sorry 😄

past pike
#

now he says Missing Permissions lol

earnest phoenix
#

does he post a message about the discord ?

past pike
#

It's a level system

earnest phoenix
#

if he doesn't normally get permission he displays his message.channel.send("No can do pal!");

keen drift
#

what are you sending

#

An embed?

past pike
#

He sends a embed if you level up

#

so i thought send messages is enough

keen drift
#

Does it have EMBED_LINK permission

#

on the channel

#

It needs embed link as well

past pike
#

lets try

earnest phoenix
#

Oo lol

#

I didn't think of a salon problem.

#

....

past pike
#

EMBED_LINK is not a permission he says

earnest phoenix
#

yes is normality

#

not EMENBED_LINK here

#

is in you configuration salon

#

not the bot

#

the salon

keen drift
#

it's on the channel permission

earnest phoenix
#

yes its i try to say this lol

#

nobody can help me in discord.js ?

#
 if (message.content.startsWith(prefix + "test")) {
    let args = message.content.split(" ").slice(1);
  let args1 = message.content.split("-r1").slice(1);
 let args2 = message.content.split("-r2").slice(1);
 let args3 = message.content.split("-r3").slice(1);
      let thingToEcho = args.join(" ")
        let thingToEcho1 = args1.join("-r1")
   let thingToEcho2 = args2.join("-r2")
  let thingToEcho3 = args3.join("-r3")
 
    var embed = new Discord.RichEmbed()
        .setDescription("Sondage")
        .addField("Question :thinking: ? : ", thingToEcho)
.addField("Réponse 1 :one: ! : ", thingToEcho1)
.addField("Réponse 2 :two: ! : ", thingToEcho2)
.addField("Réponse 3 :three: ! : ", thingToEcho3)
       .setColor('#01A1FE')
    message.guild.channels.find("name", "général").sendEmbed(embed)
    .then(function (message){
        message.react(":one:")
        message.react(":two:")
        message.react(":three:")
    }).catch(function() {
    });
    } ```
#

i have this

keen drift
#

indent tho

earnest phoenix
#

and i try to get this in finality

#

Sondage
Question 🤔 ? :
Tu est pour qui ?
Réponse 1 1⃣ ! :
la France reponse
Réponse 2 2⃣ ! :
l'Espagne
Réponse 3 3⃣ ! :
l'arbitre

#

but i have this

past pike
#

I fix my problem later. thanks for help guys

earnest phoenix
#

Sondage
Question 🤔 ? :
Tu est pour qui ? -r1 la France reponse -r2 l'Espagne -r3 l'arbitre
Réponse 1 1⃣ ! :
la France reponse -r2 l'Espagne -r3 l'arbitre
Réponse 2 2⃣ ! :
l'Espagne -r3 l'arbitre
Réponse 3 3⃣ ! :
l'arbitre

#

how I can remove this -r1 France replies -r2 Spain -r3 the referee

#

and this -r2 l'Espagne -r3 l'arbitre

knotty steeple
#

what is that for

earnest phoenix
#

is a system question with multiple reponse

#

it's a question-answer system with multiple answers

#

but i have a problem with a finality get

knotty steeple
#

pls

#

awaitMessage at least

#

or some better message collector

earnest phoenix
#

what ?

#

I'm gonna rephrase

#

i have this code actual

#

to this code I get this

#
Sondage
Question :thinking: ? :
Tu est pour qui ?  -r1 la France reponse -r2 l'Espagne -r3 l'arbitre
Réponse 1 :one: ! :
la France reponse -r2 l'Espagne -r3 l'arbitre
Réponse 2 :two: ! :
l'Espagne -r3 l'arbitre
Réponse 3 :three: ! :
l'arbitre ```
#

but I want to get that

#
Sondage
Question :thinking: ? :
Tu est pour qui ?  
Réponse 1 :one: ! :
la France reponse 
Réponse 2 :two: ! :
l'Espagne 
Réponse 3 :three: ! :
l'arbitre  ```
#

how I could remove the -r1 France reponse -r2 Spain -r3 and -r2 Spain -r3 l'arbitre

#

🤔

keen drift
#

uh get the first element

#

if I read that correctly

earnest phoenix
#

the first and the two and three but sépared

radiant hatch
#

My bot can't clear its own emotes?

spring ember
#

reactions?

radiant hatch
#

yeah

#

msg.clearReactions()

spring ember
#

this is not to clear your own

#

this is to clear all reactions

radiant hatch
#

ah

earnest phoenix
#

nobody have a solution for me ?

radiant hatch
#

so you can not clear other peoples reactions even if its on the bots message?

spring ember
#

you can if you have manage_messages perms

radiant hatch
#

do we get that permission here

spring ember
#

no

#

@earnest phoenix I am not sure what language or anything this code is

radiant hatch
#

I guess I could add a if statement for a work around but it would be slightly messier but would do the trick for a demonstration purpose on this guild

earnest phoenix
#

Oh okay you dont understant my code ?

spring ember
#

I don't know what language or Discord library it is

earnest phoenix
#

Discord.js

spring ember
#

oh ok what is the problem again?

earnest phoenix
#

I can show it to you because I'm having trouble explaining it.

spring ember
#

send me a screenshot then I won't join another server

earnest phoenix
#

okay wiat

#

wait

#

i have this

#

but I want to have his

#
Sondage
Question :thinking: ? :
Who are you for? 
Réponse 1 :one: ! :
la France 
Réponse 2 :two: ! :
l'Espagne 
Réponse 3 :three: ! :
l'arbitre ```
spring ember
#

oh

earnest phoenix
#

I don't want that.

#

r1 la France reponse -r2 l'Espagne -r3 l'arbitre

#

and that-r2 l'Espagne -r3 l'arbitre

spring ember
#

you did all the splitting wrong wait a sec

earnest phoenix
#

you understant

#

?

spring ember
#

I do

earnest phoenix
#

yes lol because my english not veru good ^^

#

very*

spring ember
#

I recommend you to learn about regexes

earnest phoenix
#

thx 😄 I have to start all over again.

#

....

heady zinc
#

you don't need to use slow regexp if you do it smartly

spring ember
#

sometimes in coding you need to start over to correct stuff, in this case you did it wrong and it's ok.

#

@heady zinc he does for the split

earnest phoenix
#

yes !

radiant hatch
#

Is this a good way to check for member guild permissions? ```js
if (msg.guild.members.get(client.user.id)).hasPermission('MANAGE_MESSAGES'){}

heady zinc
#

he doesn't

earnest phoenix
#

lol

heady zinc
#

split can take a string

spring ember
#

well a string of regexp

earnest phoenix
#

i use string lok

#

look

#

Oo nn i dontr use string lol

#
  let args = message.content.split(" ").slice(1);
  let args1 = message.content.split("-r1").slice(1);
 let args2 = message.content.split("-r2").slice(1);
 let args3 = message.content.split("-r3").slice(1);
      let thingToEcho = args.join(" ")
        let thingToEcho1 = args1.join("-r1")
   let thingToEcho2 = args2.join("-r2")
  let thingToEcho3 = args3.join("-r3")
#

confused it with slice.

spring ember
#

why are you using slice?

#

you need to do [0] or [1]

earnest phoenix
#

i dont now lol

#

I don't know what slice is.

heady zinc
#

okay let's take an example, let's just say you make the command syntax be -test <question> | <réponse_1> | <réponse_2> | <réponse_3>, then you can just do message.content.split("|")

#

except for the first argument, because you have to remove the -test thingy from it

earnest phoenix
#

its much better

#

but is not .. perfect lol

heady zinc
#

do you know how arrays work

earnest phoenix
#

no

heady zinc
#

with the thing i gave you all the possible answers are already available without anymore parsing

earnest phoenix
#

Okay 😃

heady zinc
#

you just need to do args[1], args[2] and such if you did let args = message.content.split("|")

earnest phoenix
#

I did his

spring ember
#

slice means basically that you take the array and slice it into a smaller (or the same) array

#

slice(1) means you make a new array from the second item to the last

heady zinc
#
let message = "this is a question | this is an answer | this is another answer";
let args = message.split("|");
console.log(args[0]);
//this is a question
console.log(args[1]);
//this is an answer
console.log(args[2]);
//this is another answer```
spring ember
#

message.split("\\s+|\\s+") mmLol

earnest phoenix
#

and here I am confusing xd

spring ember
#

so learn JavaScript before rushing to make your bot

#

use these links to better understand array and string manipulation to understand data

earnest phoenix
#

okay

#

but is english .. lol

heady zinc
#

it's a great french website with easily understandable courses

#

you won't do bot related things with the one course i gave you but it will give you a better understanding of how javascript works and how to do specific things, including string and arrays manipulation

earnest phoenix
#

Okay thx

radiant hatch
#

I use discordjs

abstract crystal
#

just saw mmLol

radiant hatch
#

I should probs create a info command for the bot and put library -> discordjs

#

or sneak it in help

abstract crystal
#

maybe

radiant hatch
#

I'm trying to prevent this huge duplication of my code at line 134 I'm using a if statement to check for a permission and using the else to duplicate the command because of the lack of manage_message permission I can't clear other peoples reactions and only the bots self reactions. https://codeshare.io/29VWEK

mental solstice
#

I dont think u are allowed to remove other players reactions

bold wigeon
#

how to fix it: IndentationError: unexpected unindent

mental solstice
#

Too many }'s?

turbid gale
#

at the bottom @bot.command(pass_context=True)

#

needs to be on the left wall

bold wigeon
#

still

#

dosnt work

turbid gale
#

and also the code within in the command needs to be on separate lines

#

so '''flips a coin''' and random.choice need to be seperated

turbid gale
#

await bot.send_message

bold wigeon
#

@bot.command(pass_context = True)
async def flip(ctx): '''Flip a coin''' flip = random.choice (['Heads','Tails']) await
bot.send_message(ctx.message.channel, flip)

#

here is the line

#

fix it pls

#

😃

turbid gale
#
@bot.command(pass_context=True)
async def flip(ctx):
    """Flip a coin"""
    flip = random.choice(['Heads','Tails'])
    await bot.send_message(ctx.message.channel, flip)```
#

look up how indents works

#

it might help

bold wigeon
#

still dosnt work

#

i just reset him

#

and now i cant run him

turbid gale
#

how do you have a whole bot with commands and not know how to use indents Thonk

bold wigeon
turbid gale
#

that doesn't help at all

#

oh the red

bold wigeon
#

yes

turbid gale
#

i don't see anything wrong with it

bold wigeon
#

i know

turbid gale
#

when you boot the bot what error does it return

mental trellis
#

you're probably missing a ")" somewhere

#

that happens to me. either that or I'm dumb

native narwhal
#

Does the annotation require brackets

#

@steel nacellet.event that is

#

I swear

turbid gale
#

no it doesn't

#

that's what i don't get

mental trellis
#

is it an error becasue you use async without await?

turbid gale
#

that doesn't matter

#

it's because you have a space in between print and the brackets

#

for whatever reason

#

seems like he's gone somewhere else though

#

nvm it's not

#

me ist dumb

bold wigeon
#

shea accept pls

turbid gale
#

i don't accept people idk

bold wigeon
#

just for sec

turbid gale
#

just send whatever here

#

unless you're planning to send an invite

#

that ain't happening

bold wigeon
#

i want to send the code

turbid gale
bold wigeon
#

IndentationError: unexpected unindent

#

still

turbid gale
#

what did you even change

bold wigeon
turbid gale
#

pretty sure it's not meant to be there

#

even if that could somehow work you'd be checking after the action

bold wigeon
#

thank you so much!

ruby dust
bold wigeon
#

and do you know why my ban command dosnt work?

turbid gale
#

are you mentioning a user in the server

bold wigeon
#

yes

#

can i invite you?

#

to chek

turbid gale
#

is the bots role above the users

#

and no

bold wigeon
#

yes

turbid gale
#

does it have the ban members permission

bold wigeon
#

yes

turbid gale
#

and does the user using the command have the role owner which is what i'm guessing is what that check is looking for

bold wigeon
#

yes

turbid gale
#

should work then

#

do you mean why your unban command doesn't work Thonk

bold wigeon
#

no

turbid gale
#

because i can see why that won't work too

bold wigeon
#

the ban

#

oh

turbid gale
#

don't see anything wrong with ban

#

unless you need to define the server

bold wigeon
#

can u write the fixed code? pls

turbid gale
#

i'm not coding your bot for you

bold wigeon
#

i know

turbid gale
#

use the docs might help

#

but if you don't even know how to fix your indents i doubt you actually coded your bot

bold wigeon
#

i did it

radiant hatch
#

If you create a function like sendEmbed(desc, title, fields) but you do not want to fill out fields would you just put null?

mental solstice
#

A space

drowsy sentinel
#

Or you can create a string array, and use the embed description.

inner jewel
#

@earnest phoenix the recommended way is using scheduled executors

#

java.util.concurrent.ScheduledExecutorService
java.util.concurrent.Executors.newScheduledThreadPool()

earnest phoenix
#

oh ok

#

tyvm

knotty steeple
#

why do i need python (python 2) to get certain node modules?

inner jewel
#

because they use node's native api

#

and the tool used for building them uses python

knotty steeple
#

🤔

#

great now i have to install python

#

ok what is the exact version i need to install

quartz kindle
#

you need node-gyp which requires python 2.7

#

node-gyp is node's build tool, which builds modules that were written in other languages that need compiling, such as C, C++, etc

#

they often need system specific settings and/or files in the building process, thats why they usually cant be pre-compiled into plug-and-play modules

radiant hatch
#

what permission is required for a bot to fetch invites?

sullen path
#

I believe it need to access the audit log, but I could be wrong

radiant hatch
#

its not

sullen path
#

Ok

radiant hatch
#

its manage_server

inner jewel
#

^

earnest phoenix
#

hi... anyone know how to get voiceChannel id after create channel with Discord.js?

message.guild.createChannel('ID CHANNEL 1 : ' + `${message.channel.id}`, 'voice',[{ id: message.guild.id, deny:0x00100000, allow:0x00000400 }]);

how to make Channel name will show the channel ID?

keen drift
#

It returns a promise that resolves to that new channel

earnest phoenix
#

Ik people don't like glitch here.

#

But how would I require the image in assets?

#

The direct asset

#

Not a link

#

For Canvas

#

plz help

earnest phoenix
#

Does anyone know how?

#

I get this error

UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 4): Error: error while reading from input stream
#

Idk what the directory for assets is

#

???

#

Anyone know?

earnest phoenix
#

@bright spear Where do I put the link to the image or whatever?

function previewFile() {
       var preview = document.querySelector('img'); //selects the query named img
       var file    = document.querySelector('input[type=file]').files[0]; //sames as here
       var reader  = new FileReader();

       reader.onloadend = function () {
           preview.src = reader.result;
       }

       if (file) {
           reader.readAsDataURL(file); //reads the data as a URL
       } else {
           preview.src = "";
       }
  }

  previewFile();  //calls the function named previewFile()
#

oh

#

I see

bright spear
#

that references document which only works in HTML

earnest phoenix
#

oh

#

idk whats a good one

bold wigeon
earnest phoenix
#

Idk

#

Idk python

bold wigeon
#

i have problem with this part

#

dosnt work

earnest phoenix
#

@bright spear Do you know any ones that don't need HTML?

bright spear
#

idk

earnest phoenix
#

oof

#

I really need to do this ;-;

bold wigeon
#

FIXED IT

slender thistle
#

Was it the discord.Embed(name= thing?

#

Because discord.Embed doesn't have a paremeter name GWfroggyBlobThonk

earnest phoenix
#

Anyone know how to require an image in glitch?

#

Like the actual file.

#

no one know how to do that?

#

the javascript script image method uses html

bold wigeon
#

the last line after the await

#

please

#

nvm

earnest phoenix
#

How do I put text over an image?

#

Any text

#

That the user inputs

wispy schooner
#

Canvas or jimp @earnest phoenix

earnest phoenix
#

Canvas doesn't work for me

#

Scroll up

#

Glitch doesn't like canvas

#

because I can't give an image dir

sick cloud
#

eww Glitch

earnest phoenix
#

Shut up

#

lol

sick cloud
#

ayy don't be mean :(

earnest phoenix
#

I was jk

sick cloud
#

Glitch is okay I guess. You can load pictures off the internet though Canvas I thought Thonk

wispy schooner
#

I got canvas to work on glitch no problem lol

earnest phoenix
#

No

#

Wait what

sick cloud
#

¯_(ツ)_/¯

earnest phoenix
#

The problem is I can't require the image

sick cloud
#

I've used Canvas on Glitch a few times

short siren
#

Just so you know people can hack glitch bots like iv known a few people who used it but someone got there token and bombed all there servers

wispy schooner
#

Yeah, glitch isn't secure

earnest phoenix
#

Well I'm new to js

wispy schooner
#

Which is why I avoid the hell out of it

sick cloud
#

aren't we all?

#

I only use Glitch for websites that don't mean much to me

wispy schooner
#

Buy a real, secure vps

sick cloud
#

OVH >:3

earnest phoenix
#

I'm not spending money ;-;

short siren
#

Or get a free 12 months trial on azure I'm cheap :D

earnest phoenix
#

Idc if my bot gets ruined

#

¯_(ツ)_/¯

sick cloud
#

lmao

earnest phoenix
#

It's not that good

sick cloud
#

take backups then

earnest phoenix
#

I just want to know how to make canvas work with it

sick cloud
#

jic

abstract mango
#

@shy verge maybe you'd care to offer this fellow some gud host

earnest phoenix
#

?

#

Who hosts?

abstract mango
#

solarys offers hosting for bots under 500 guilds i think

earnest phoenix
#

How much does it cost?

abstract mango
#

free

earnest phoenix
#

Yo

#

Serious

abstract mango
#

your bot has to be opensource and stuff though

#

lemme get the gist

earnest phoenix
#

Can I do that with VSCode?

#

That way I can require an image 😃

#

You there?

#

It says your idle

abstract mango
#

i'm always idle lol

#

idk where the gist is, just wait for solarys to respond

#

also vscode is just another editor so lol

#

anyways i'm out

earnest phoenix
#

kk

wispy schooner
#

@earnest phoenix you may not care if your bot gets ruined, but what about all the servers your bot is on? If those get trashed you will be held responsible until the real culprit is caught, and even more so if you use something as insecure as glitch

earnest phoenix
#

kk

#

Thats why im gonna host with solary

#

It will also fix my problem

abstract mango
#

maybe.

#

you need to make sure your token is safe

#

like

#

put it in a seperate file no one else can see

earnest phoenix
#

My Discord Bot token is in the .env file

abstract mango
#

yeah that's good

earnest phoenix
#

Can hackers hack that?

abstract mango
#

if you open source it and put it on git you need to make sure you gitignore .env

earnest phoenix
#

?

ruby dust
#

I wonder if it's the same code that can be run even if the file is encrypted

earnest phoenix
#

Can someone help with Canvas on glitch?

neat falcon
#

glitch angeryBOYE

earnest phoenix
#

I wanna add text over an image

neat falcon
#

Same

wispy schooner
#

@earnest phoenix find the absolute URL to the asset

earnest phoenix
#

No, URLs don't work

wispy schooner
#

Then use fs to load it into a buffer and you're golden

earnest phoenix
#

But idk js stuff

wispy schooner
#

Actually, you can use snekfetch to grab the file via url

earnest phoenix
#
Unhandled promise rejection (rejection id: 4): Error: error while reading from input stream
#
client.on('guildMemberAdd', async member => {
    const channel = member.guild.channels.find(ch => ch.name === 'new-members');
    if (!channel) return;
    const canvas = Canvas.createCanvas(700, 250);
    const ctx = canvas.getContext('2d');

    // Since the image takes time to load, you should await it
    const background = await Canvas.loadImage('/assets/wallpaper.jpg');
    // This uses the canvas dimensions to stretch the image onto the entire canvas
    ctx.drawImage(background, 0, 0, canvas.width, canvas.height);
    // Use helpful Attachment class structure to process the file for you
    const attachment = new Discord.Attachment(canvas.toBuffer(), 'welcome-image.png');

    channel.send(`Welcome to the server, ${member}!`, attachment);
});
wispy schooner
#

Yes, because you're loading a file path, not a url

earnest phoenix
#

But when I put a url in there it does the same thing

wispy schooner
#

Which you get via snekfetch

#

Yes, because node canvas is expecting a buffer

sick cloud
#

snekfetch.get(image url)

wispy schooner
#

Yes, because node canvas is expecting a buffer

sick cloud
#

iirc

wispy schooner
#

Yeaj

earnest phoenix
#

Wait

#

wait wait wait

#

But then what do I put in the brackets?

#

Canvas.loadImage('What do I then type here?');

wispy schooner
#

const { body } = snekfetch.get('URL')

sick cloud
#
const { body } = await snekfetch.get('image url');
const background = await Canvas.loadImage(img);```
#

i guess

wispy schooner
#

Body returns the buffer you need

earnest phoenix
#

Thanks

#

Ok then glitch

wispy schooner
#

@sick cloud wouldn't work, snekfetch doesn't return img

sick cloud
#

use { body }

#

yeah

short siren
#

A bonus of using glitch is you don't have to install canvas though

sick cloud
#

I figured that out after a second

earnest phoenix
#

Still has the same thing

wispy schooner
#

Use a valid version of node if you want async await

earnest phoenix
#

Do I need await in this?

sick cloud
#

Yeah Thonk

#

Its so the code doesn't keep going until the image is loaded and such I think

earnest phoenix
#

It says "The keyword await is reversed"

#

Do I literally type { body } ?

abstract mango
#

i think you're using async in non-async function

earnest phoenix
#

I think thats completely wrong

sick cloud
#

you need to use it INSIDE guildMemberAdd

earnest phoenix
#

kk

sick cloud
#

before you load the image into ctx

earnest phoenix
#

This look right?

sick cloud
#

yess

earnest phoenix
#

K thanks

#

inb4 'image url' not working

#

?

#

YES

#

THANKS SO MUCH EVERYONE

#

My bot is offline and the code has an error

sick cloud
#

whats the error?

earnest phoenix
#

Can anyone help

sick cloud
#

we can't help if you don't give us code/errors

earnest phoenix
#

Running the bot to get the errro

#

Traceback (most recent call last):
File "python", line 59, in <module>
discord.errors.LoginFailure: Improper token has been passed.

#

oh no

#

python

#

Last line of the code

sick cloud
#

your token is incorrect

earnest phoenix
#

Yep

sick cloud
#

regenerate it

earnest phoenix
#

I know that much

sick cloud
#

and try a new one

earnest phoenix
#

OK

#

ok

#

Huh, why is my name changed?

#

Traceback (most recent call last):
File "python", line 59, in <module>
discord.errors.LoginFailure: Improper token has been passed. same

#

@here anyone fluent in python?

#

are you copying the whole token

#

Yep

#

and are you sure you are copying the right thing

#

Yep

#

Underneath user it says token on the discord develop page

#

And because of this my bot is offline so I can't get it on the server

#

I am on the repl.it server, and they can't help.

#

So pls!

#

Just tried your code, works fine. your token is wrong.

#

I don't get that

#

or os.environ['TOKEN'] is not the token

#

print that and see if it matches your actual token

#

I am saddly on mac thou

#

ok

grizzled totem
#

wtf is this??

(node:238803) UnhandledPromiseRejectionWarning: TypeError: Cannot destructure property `prefix` of 'undefined' or 'null'.
    at Client.client.on (/root/Blurp/messageHandler.js:36:5)
    at <anonymous>
(node:238803) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:238803) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
#

my database suddenly just isn't working

earnest phoenix
#

mate ny bot isn't working

grizzled totem
#

ok..?

earnest phoenix
#

^^^^^^ Read up

#

what db and can you send the surrounding code?

grizzled totem
#

fixed, it was corrupted 😦

#

@earnest phoenix i don't work with python

earnest phoenix
#

Ahhhh

#

No one seems to

#

did you check if your token matches to os.whatever you had?

grizzled totem
#

okay wait its broken again

earnest phoenix
#

ok

grizzled totem
#

@earnest phoenix

let { prefix } = await r.table('guilds').get(msg.guild.id);
        if (!prefix) {
            await r.table('guilds').insert({
                id:msg.guild.id,
                prefix:'!',
                modlog:'disabled',
                caseId:0
            });
            let { prefix } = await r.table('guilds').get(msg.guild.id);
        }

thats where its erroring i believe

earnest phoenix
#

isben are you doing like { prefix, something } = db.get(guild id) basically

grizzled totem
#

and i'm using rethinkdb

earnest phoenix
#

oh nvm

#

print what you are getting from the guilds table, probably undefined

grizzled totem
#

its also weirdly not inserting the data into rethink

earnest phoenix
#

its trying to get property from that that doesnt exist

grizzled totem
earnest phoenix
#

well that would explain lol

grizzled totem
#

its supposed to insert the guild if it doesn't exist

#

but it just errors there

earnest phoenix
#

🤔

#

did you restart rethink with a different directory for the data?

grizzled totem
#

i could try resetting it since its kind of being buggy

earnest phoenix
#

not sure why it wouldnt be writing, dont use rethink myself

grizzled totem
#

ohk i think i just stuffed it up

earnest phoenix
#

uhh i think i know why

#

pretty sure let { prefix } = await r.table('guilds').get(msg.guild.id); would fail if the db returns null

#

since it cant destructure

#

so it never gets to the if and never writes to the db

#

just do let something = db.get

#

then check if !something

slender thistle
#

@earnest phoenix Send the token in my DMs please (feel free to reset it right after sending)

grizzled totem
#

its totally fixed now actually @earnest phoenix not the codes fault

#

my rethinkdb instance was totally corrupted

earnest phoenix
#

🤷 ok

grizzled totem
#

thanks for the help

#

i'm gonna give up on my bot now, database is totally fucked

#

i had to manually insert the guild into the database

earnest phoenix
#

try what i said

grizzled totem
#

its just failing to insert into the db apparently

#

gonna try it though, yeah

earnest phoenix
#

ok

#

I made the greatest thing ever

#

When they join its the pigeon meme

#

@austere meadow Can you unmute my bot?

gilded plankBOT
#
Multi Raxerz#6586
Bots

@pallid void

austere meadow
#

@pallid void

earnest phoenix
#

How do I make it so on this server it doesn't do things but on others it does?

#

Well, what I actually wanna do is something slightly different

austere meadow
#

add a check for this guild
if (message.guild.id == "264445053596991498") { //do stuff

earnest phoenix
#

kk

#

and also ```
if (message.guild.id == "264445053596991498" return;

if you wanna disable a command?
austere meadow
#

yeah

earnest phoenix
#

kk

grizzled totem
#

guild isn't defined

#

use member.guild

earnest phoenix
#

kk

#

thanks 😃

grizzled totem
#

np

earnest phoenix
grizzled totem
#

lol

earnest phoenix
#

wew

#

I think I broke it

#

@pallid void

#

@austere meadow There is a bot that is responding to oof

#

oof

#

@earnest phoenix Don't you love it when you type +help in #general

#

Do it

#

naw

#

lol

#

why would I tho

runic cloud
earnest phoenix
#

you didn't close the JSON

runic cloud
#

?

earnest phoenix
#

oh

runic cloud
#

Thank

grizzled totem
#

how you do set the size of msg.author.displayAvatarURL?

earnest phoenix
#

msg.author.displayAvatarURL + "?size=1000"

#

i think

#

lemme test

grizzled totem
#

it auto adds size on the end

earnest phoenix
#

oh

grizzled totem
#

but its setting it to 128 etc

earnest phoenix
#

nope it doesn't

#

do

#

use replace

#

("?size=2048", "?size=1024")

#

or somethin idek

#

somehow replace it

#

:>

#

oUf

grizzled totem
#

another question actually, can you replace the reply method? .reply returns an @mention, can you make it show the users name only but bold?

#

so **username**, content here instead of @username, content here

runic cloud
#

help

#

pls

grizzled totem
#

is that your token

runic cloud
#

no

grizzled totem
#

[Paster] ... looks like it

runic cloud
grizzled totem
#

your logging your token

#

and now its public gg

#

also thats your issue, message event hasn't got any message set

runic cloud
#

eliminated image

grizzled totem
#

async () should be async (msg)

runic cloud
#

LOL

grizzled totem
#

ok

runic cloud
#

ah

#

does not work

#

@grizzled totem help pls

grizzled totem
#

i gtg

#

but you set it as message

runic cloud
#

I'm a new programmer I have to learn

#

so?

#

@grizzled totem

#

you are there

slender thistle
#

Restart the bot?

#

message.conetent, huh?

runic cloud
#

ye

#

wait a few moment

#

@slender thistle

#

does anyone help me?

ruby dust
#

People are busy, just wait until someone will come with the answer

earnest phoenix
#

bois

#

you did "message.conetent.split"

runic cloud
#

@earnest phoenix what should I do then?

earnest phoenix
#

change it to

#

"message.content.split"

#

I guess..

runic cloud
earnest phoenix
#

I think so, othervise I have a working code for commands..

slender thistle
#

@runic cloud message.content.split()

earnest phoenix
#

^

slender thistle
#

Or msg.content.split()

#

Since you have msg defined

runic cloud
#

Ok

#

Thank

#

does not work

earnest phoenix
#

rip

runic cloud
#

wait

earnest phoenix
#

hm

runic cloud
earnest phoenix
#

wew

#

also add ; after the console.log :>

#

prob not needed but xd

runic cloud
#

yep

#

yep

#

it works !!

#

it works !!

earnest phoenix
#

mk

#

also should do msg.channel.type != 'text'

#

sionce it could be groupdm

jolly mist
earnest phoenix
#

bots can't be added to group dm @earnest phoenix

#

bc you need to be friend with it and you can't be that

#

(if it's a bot user)

#

ahhhhh ok

#

and selfbots is not allowed so

#

yeete

#

@jolly mist , missing comma after json.stringify

jolly mist
#

?

#

where exactly?

earnest phoenix
jolly mist
#

ooh, crap

earnest phoenix
#

I thought that but I wasn't sure :3 xd

jolly mist
#

?????

slender thistle
#

MENAGE_MEMBERS is not a valid permission

abstract mango
#

ah yes

radiant ridge
#

Does anybody know if a website is required for certification?

abstract mango
#

i think so

slender thistle
#

Afaik, an empty GitHub repo with widget would do

#

Could be wrong, ofc

radiant ridge
#

Aight

abstract mango
#

ye

#

you need widgets

radiant ridge
#

Thanks

abstract mango
#

np

earnest phoenix
#

anyone know how to fix it in discord.js? Console: "TypeError: member.addRole is not a function

runic cloud
#

Help

earnest phoenix
#

what version discord.js @earnest phoenix

runic cloud
#

where did I go wrong?

earnest phoenix
#

where to see version? 🤔

#

npm list discord.js

#

wrong parameters for setActivity @runic cloud

runic cloud
#

how I put it

earnest phoenix
#

1.0.0

#

@earnest phoenix you sure? i mean stable is like 11.3.2 and master is 12.0.0

#

oh sorry mine is 11.3.2

#

@earnest phoenix

earnest phoenix
#

ok are you using .addrole on an actual GuildMember like:

  .then(console.log)
  .catch(console.error);```
#

@jolly mist typo on first line of your command. 'MENAGE_MEMBERS' is not a permission

#

maybe more but that stuck out immediately

jolly mist
#

but what should I do then ??

earnest phoenix
#

correct the typo? chu mean dog

#

😂

#

thanks, i think my code had any small mistake 🤔

#

👌

runic cloud
shut igloo
#

Wtf

#

You coding maniacs

earnest phoenix
#

whats the issue @runic cloud

runic cloud
#

this

ruby dust
#

isn't the color suppose to be an integer?

earnest phoenix
#

will be converted automatically

bitter sundial
#

I think d.js handles hex

runic cloud
#

I do not think so

bitter sundial
#

ColorResolvable Can be a Hex Literal, Hex String, Number, RGB Array, or one of the following

runic cloud
#

@earnest phoenix

earnest phoenix
#

.addField not setField

runic cloud
#

Thank

earnest phoenix
#

👌

runic cloud
#

is nice

bold wigeon
#

the bot dosnt work when after i did this

earnest phoenix
#

any error?

ruby dust
#

sigh, you are back with basic issues

#

the decorator is poorly indented

earnest phoenix
#

oh god indentation error lol

#

python 🤢

ruby dust
#

I really recommend you to learn more of python to at least understand what you are doing yourself

bold wigeon
#

fixed it

#

i fixed it

runic cloud
#

How do I choose the size of the text?

ruby dust
#

wdym?

runic cloud
#

How do I choose the size of the text?

ruby dust
earnest phoenix
#

😂

ruby dust
#

wdym?

earnest phoenix
#

in an embed you cant (based on ur last question)

#

i mean title and embed title have bold text i think

runic cloud
#

as

#

as?

earnest phoenix
#

ruby dust
#

if you'd know how embeds work, you'd know lol

runic cloud
slender thistle
#

msg.guild.roles?

runic cloud
#

not work

ruby dust
#

you have to provide it with the server you want to look for roles at

runic cloud
#

what do you mean?

ruby dust
#

your bot doesn't know which server to look at to begin with

slender thistle
#

Well, the file doesn't know what guild is because you did not define it GWchadThink

ruby dust
#

guild doesn't just say "server where command was ran", especially when the bot is in multiple servers

runic cloud
#

come and have a say?

ruby dust
#

what

runic cloud
#

what command should I give to tell the bot what server to watch

ruby dust
#

I don't code in discord.js, so your best bet would be to find the reference yourself in the docs

knotty steeple
#

ok so im looking at that screenshot

#

sendEmbed is a thing?

turbid gale
#

msg.channel.send({embed});

#

it would be that

knotty steeple
#

yes

#

cuz i dont think you can do sendEmbed

ruby dust
#

Don't rely on newby's code facepalm

knotty steeple
#

yes what is wrong with me

turbid gale
#

let me change it to his code because knowing people he'll copy it

#

word for word

bold wigeon
#

wrong link

#

sec

#

???

ruby dust
#

look closer, the answer is too obvious to point it out

#

actually 2 issues, both are very obvious

knotty steeple
#

even i see the both issues

ruby dust
#

wait what? I like how you defined fields, so it's a lot more than 2

knotty steeple
#

huh

bold wigeon
#

value

#

?

ruby dust
#

I'm gonna say one thing, fields must contain both names and values

#

the rest issues are on yourself

bold wigeon
#

im trying to fix without success

ruby dust
#

ok, ima try to help without spoonfeeding the answers

#

show what you've done so far

bold wigeon
#

my bot work perfectly without the last code lines

earnest phoenix
bold wigeon
#

@steel nacellet.command(pass_context=True)
async def israel(ctx):
await bot.say("🇮🇱 you found the secret command")
print ("user has found the secret command")

#

what the problem here

#

???

slender thistle
#

None

bold wigeon
#

the program said there is

#

and i cant find the problem

slender thistle
#

What is the error

bold wigeon
#

fixed it

#

nvm

spring ember
#

@bold wigeon ctx.say()?

slender thistle
#

ctx doesn't have say

#

And that's async branch

#

So, it is bot.say

lilac obsidian
#

hes using async not rewrite