#development

1 messages · Page 352 of 1

stone kiln
#

yep

fervent goblet
#

yeah

#

I love it

stone kiln
#

same

fervent goblet
#

users:{id}:key

#

lol exactly 500 lines of code

#

thats funny

inner jewel
#

you can also use hashes

#

name the hash users:<id>

#

and have the fields inside

fervent goblet
#

yeah

#

I prefer the way I do it rn tho

#

idk why

sand axle
glossy sand
#

something called video_info is null

cedar maple
#

another red user 😄

glossy sand
#

i suspect you're trying to look up a nonexistent video

sand axle
#

im trying to find one that does what i want xD

#

so far this one cant even play so its going well.

cedar maple
#

lol

#

what play music in general?

sand axle
#

im after something that will auto play previously requested songs. Then bump new requests to the front

cedar maple
#

ahh

sand axle
#

ie, if no ones requested anything, just play something from previously requested. Else, play the recent requests

#

and nothing seems to do that

cedar maple
#

so you want a bot that will just play music randomly basicly, if it has been queued before right?

glossy sand
#

you mean you want it to play continuously?

sand axle
#

yeah

glossy sand
#

nobody's insane enough to write a bot that does that

sand axle
#

continuously, although i dont mind it going silent if no one is in channel

cedar maple
#

just make a playlist on youtube and stack the hell out of it and do shuffle and repeat

#

xD

sand axle
#

yeah lol

glossy sand
#

it would be too intensive to continuously play music on a bot with a large userbase

#

you're probably better off writing your own bot or modding an existing one

sand axle
#

im looking at self hosted ones for that reason

cedar maple
#

yeah im on 200 servers with my bot nemu and she laggs if i have that setting, have you taken a look at Fredboat?

sand axle
#

yeah i might mod/code something just hoping something had it out of the box

#

and no i havent. Will look now ty.

cedar maple
#

from what i know off right now fredboat can play livestreams

sand axle
#

latest commit in a folder im looking at
" Proper usage of the BrainfuckException"

bodes well already 😄

cedar maple
#

did you get the link i sent you?

sand axle
#

java too, would make it easier for me to hack something together than trying to figure python out lol

#

yes, ty, was looking at the docs

cedar maple
#

your allowed to change fredboat selfhost around

sand axle
#

then went to their github

cedar maple
#

how ever you like

#

lol, im admin on it so meh, thats where i know all about it XD

sand axle
#

actually looks pretty good.

#

looks a good baseline for me to add the small functionality i want.

cedar maple
#

yeah its not a bad bot

sand axle
#

flicking through the code files it isnt coded like ass so, good start.

cedar maple
#

my new bot called six is fredboat clone

sand axle
#

im used to coding in c# but i should be able to cobble some java together xD

#

copy pasta stack overflow 😉

cedar maple
#

java's kinda easy lol

sand axle
#

easier than me understanding python at least. More of a chance going c# -> java than c# -> python thats for sure

cedar maple
#

yep

sand axle
#

awesome, thanks for this. going to have a crack at it 😃

cedar maple
#

np yw

earnest phoenix
#

Hmmm

sand axle
#

looks like a bot i already have on my server might do it

#

if i kick of a queue and add a song to it, i can set that queue to repeat

#

anyone plays a song, it adds to that queue (even though the docs say it shouldnt)

#

and it puts it to next, so, perfect.. unless someone clears the queue

fervent goblet
#

okay now that I've created many side commands, lets get to my bots core functionality

#

xD

earnest phoenix
#

anyone good with music in d.js?

glossy sand
#

what are you trying to do specifically

earnest phoenix
#

pause

#

but

#

the dispatcher/server.connection is not letting me run any functions on it

umbral pelican
#

channel.connection.dispatcher.pause()

#

iirc

glossy sand
#

what do you mean by "not letting me run functions"

#

does it throw x is not a function or

earnest phoenix
#

so I would just do msg.member.voicechannel.connection.dispatcher.pause()?

umbral pelican
#

voiceChannel

earnest phoenix
#

TypeError: server.connection.pause is not a function

#

@umbral pelican yeah, typo 😃

glossy sand
#

no, it's on VoiceConnection#dispatcher

#

connection.dispatcher.pause()

earnest phoenix
#
msg.member.voiceChannel.connection.dispatcher.pause()

#

so that would work right?

glossy sand
#

assuming the bot is in the vc, yeah

earnest phoenix
#

YAY!

#

aight, thanks!

glossy sand
#

but you should note the "stream may still progress however" in the docs for pause

earnest phoenix
#

it workeh

#

yeah, I know

cedar maple
#

ok i hit a wall. >.<

glossy sand
#

do tell

cedar maple
#

AttributeError: module 'discord' has no attribute 'Client'

#

i dont get it >.<

icy lynx
#

I assume you have discord.Client

#

somewhere

cedar maple
#

installed using pip3 or pip right?

#

let me check i have like 20 files

icy lynx
#

ahh you are usind discordpy

tawny lava
#

it's discord.Bot in discordpy iirc

cedar maple
#

nah i dont

icy lynx
#

python3 -m pip install -U discord.py

#

Have you done this?

cedar maple
#

yes

icy lynx
#

and your code imports it?

cedar maple
#
  • the python3 -m
#

yeah

earnest phoenix
#

ew python

cedar maple
#
import os
import sys
sys.path.insert(0, "lib")
import logging
import logging.handlers
import traceback
import datetime
import subprocess```
#

pushs to another file

#

well you are right i dont see discord.Client

icy lynx
#
import asyncio

client = discord.Client()

@client.event
async def on_ready():
    print('Logged in as')
    print(client.user.name)
    print(client.user.id)
    print('------')

@client.event
async def on_message(message):
    if message.content.startswith('!test'):
        counter = 0
        tmp = await client.send_message(message.channel, 'Calculating messages...')
        async for log in client.logs_from(message.channel, limit=100):
            if log.author == message.author:
                counter += 1

        await client.edit_message(tmp, 'You have {} messages.'.format(counter))
    elif message.content.startswith('!sleep'):
        await asyncio.sleep(5)
        await client.send_message(message.channel, 'Done sleeping')

client.run('token')```
cedar maple
#

.<

icy lynx
#

This is a working example

#

Does it work on your side?

cedar maple
#

nope

#

ohj

#

that

#

i have that it works fine

icy lynx
#

Have you used discord.Client or discord.Client() ?

cedar maple
#

let me check

#

bot = discord.Client()

icy lynx
#

Can you show full code

cedar maple
#

not possable lol

#

XD

#

i have to upload it lel

icy lynx
#

Or atleast the part where the error might be

cedar maple
#

ok

quiet bobcat
#

How can I move the div class shapes-background shapes-1 up on discord bots?

icy lynx
#

oo wait

cedar maple
#

what?

icy lynx
#

import discord

cedar maple
#

lol

icy lynx
#

You don't have it?

cedar maple
#
from .dataIO import dataIO
from copy import deepcopy
import discord
import os
import argparse
#

see

icy lynx
#

Can you try adding it to your init file?

#

Just for testing

cedar maple
#

ok

#

same error

#
  File "six.py", line 10, in <module>
    import discord
  File "C:\Users\alyzz\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\__init__.py", line 20, in <module>
    from .client import Client, AppInfo, ChannelPermissions
  File "C:\Users\alyzz\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\client.py", line 42, in <module>
    from .voice_client import VoiceClient
  File "C:\Users\alyzz\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\voice_client.py", line 59, in <module>
    import nacl.secret
  File "C:\Users\alyzz\AppData\Local\Programs\Python\Python36-32\lib\site-packages\nacl\secret.py", line 19, in <module>
    from nacl.utils import EncryptedMessage, StringFixer
  File "C:\Users\alyzz\AppData\Local\Programs\Python\Python36-32\lib\site-packages\nacl\utils.py", line 17, in <module>
    import six
  File "D:\Six.py\six.py", line 14, in <module>
    from discord.ext import commands
  File "C:\Users\alyzz\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\__init__.py", line 13, in <module>
    from .bot import Bot, when_mentioned, when_mentioned_or
  File "C:\Users\alyzz\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\bot.py", line 146, in <module>
    class Bot(GroupMixin, discord.Client):
AttributeError: module 'discord' has no attribute 'Client'```
#

i dont think i have discord.Client

#

.<

icy lynx
#

class Bot(GroupMixin, discord.Client):

#

do class Bot(GroupMixin, bot):

#

since it's already set

cedar maple
#

class Bot(commands.Bot): thats my class for Bot

icy lynx
#

File "C:\Users\alyzz\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\bot.py", line 146, in <module>
class Bot(GroupMixin, discord.Client):

#

Can you show me some of these lines=

cedar maple
#

oh in there lol

icy lynx
#

also, you have class Bot twice?

cedar maple
#

nope

#

class Bot(GroupMixin, discord.Client):

#

lol its the same

#

oh ic the issue

#

nvm

#

xD

icy lynx
#

👍

cedar maple
#

im using mods

#

as my cogs

#

thats why lol

#

faceplam

earnest phoenix
#

Hello, i have a problem, i dev from javascript.. node.js.. but my code is not good
Also, i have a problem from json

bot.on("message", message => {
    if(message.content.startsWith(PREFIX + 'si')) {
        message.channel.send({embed: {
            color: 0x868080,
            author: message.author.username,
            title: "Voici les Informations du Serveur : " + message.guild.name,
            description: "**>-•-<**",
            fields: [{
                name: "ID : ",
                value: message.guild.id,
                inline: true
            }, {
                name: "Créateur : ",
                value: message.guild.owner,
                inline: true
            }, {
                name: "Localisation : ",
                value: message.guild.region,
                inline: true
            }, {
                name: "Membres Présents:",
                value: message.guild.memberCount,
                inline: true
            }, {
                name: "Création le : ",
                value: message.guild.createdAt,
                inline: true
            }]
        }});
    }
});```
This code is not good
The message error is : converting circular strucutre to JSON
And i dont know wat this
can you help me ?
glossy sand
#

again, message.guild.owner is a user object

#

you want message.guild.owner.username

earnest phoenix
#

yeah

icy lynx
#

Yep, you need to change it

earnest phoenix
#

You are advanced me

#

the message error is Invalid form body

glossy sand
earnest phoenix
#

I do not understand anything about doc

glossy sand
#

er

earnest phoenix
#

yeah

#

i'm an idiot^

glossy sand
#

so when you create the field { name: "Créateur : ", value: message.guild.owner }

#

i expect you think message.guild.owner is a string

earnest phoenix
#

ah

glossy sand
#

it's, uh, not a string

earnest phoenix
#

message.guild.owner.username

glossy sand
#

right

earnest phoenix
#

xd

#

yeah but

#

the msg error :

#

Invalid form body

cedar maple
glossy sand
#

i think your author object is incorrectly formatted as well

#

it's supposed to be ```js
author: {
name: 'foo'
}

or something
earnest phoenix
#

but me is : author : message.author.username

#

i think it's a problem GWrjkSeemsKappa

#

ah

#

modifie tous tes trucs en example

author: {
  name: 'foo'
}
#

ok

#

un peu comme

            }, {
                name: "Localisation : ",
                value: message.guild.region,
                inline: true
            }, {
                name: "Membres Présents:",
                value: message.guild.memberCount,
                inline: true
            }, {
#

this is correct ?

#

author: {
name: message.author.username,
},

#

mais pour

            color: 0x868080,
            author: message.author.username,
            title: "Voici les Informations du Serveur : " + message.guild.name,
            description: "**>-•-<**",
#

commeça

#

author: {
name: message.author.username,
},

glossy sand
earnest phoenix
#

mmh jpense ou pas cher aps @earnest phoenix

#

fait pareil que celà

            }, {
                name: "Localisation : ",
                value: message.guild.region,
                inline: true
            }, {
                name: "Membres Présents:",
                value: message.guild.memberCount,
                inline: true
            }, {
#

mais wa

#

t

#

j'ai fais ce que vous avez demander

#

et ?

#
    if(message.content.startsWith(PREFIX + 'si')) {
        message.channel.send({embed: {
            color: 0x868080,
            author: {
                name: message.author.username,
            },
            title: "Voici les Informations du Serveur : " + message.guild.name,
            description: "**>-•-<**",
            fields: [{
                name: "ID : ",
                value: message.guild.id,
                inline: true
            }, {
                name: "Créateur : ",
                value: message.guild.owner.username,
                inline: true
            }, {
                name: "Localisation : ",
                value: message.guild.region,
                inline: true
            }, {
                name: "Membres Présents:",
                value: message.guild.memberCount,
                inline: true
            }, {
                name: "Création le : ",
                value: message.guild.createdAt,
                inline: true
            }]
        }});
    }
});
#

mmmhhh GWrjkKappaLUL

#

Nope

#

nope

#
            author: {
                name: message.author.username,
            },
#

ça cpas mal ça ^

#

mais continue pour les autres

glossy sand
#

er are you sure about that @earnest phoenix

#

docs indicate "author" is an author object

earnest phoenix
#

euh

#

example

            ExampleAuthor: {
                LeNom: "TonTruc",
            }, {
#

MAIS WAR

#

@glossy sand ah !

#

Vous me compliquez la vie la "-"

#

@glossy sand help them i'm a dev for python not js

glossy sand
#

i only speak as much french as it's a cognate for spanish

earnest phoenix
#

google translate x)

#

xdxd

#

i don't know.

#

@earnest phoenix rip demande à un autre GWrjkSeemsKappa

#

yey

naive hazel
#

How can I use message author's avatar in embeds?

#

It gives "Not well formed URL" error

uncut slate
#

language / library

naive hazel
#

discord js

uncut slate
#
image: {
  url: msg.author.avatarURL
}
naive hazel
#

Can I do it in rich embed?

uncut slate
#

that is a rich embed

naive hazel
#

Oh there we go

#

Thank you 😄

quiet bobcat
#

How can I see the guild owners name and discrim without mentioning them?

glossy sand
#

programmatically, you mean?

quiet bobcat
#

I guess, I have a guild log channel but it mentions them. It often looks weird and only mentions people sometimes. Therefore I want just a name and discrim. The bot sends an embed when it joins a guild

glossy sand
#

you could just not include the @

quiet bobcat
#

The code for it is guild.owner

#

So it has no @

glossy sand
#

I mean I don't entirely understand your issue

#

you're trying to output username and discrim but it's causing the users to be tagged?

quiet bobcat
#

No, I want the username and discrim, but when I try to it says undefined#undefined

earnest phoenix
#

If you have a command to have the logs of a bot that joins the servers tell me! (The bot sends a message with the info of the servers in a channel)

Discord.py

glossy sand
#

oh okay

#

discord.js?

quiet bobcat
#

Yeah

glossy sand
#

it should be as simple as ${guild.user.username}#${guild.owner.discrim} right

quiet bobcat
#

guild.user?

glossy sand
#

er, owner I mean

quiet bobcat
#

ok

#

I can try

earnest phoenix
#

xd guild.user.username

glossy sand
#

actually no I'm wrong

quiet bobcat
#

?

glossy sand
#

you'll have to ${guild.owner.user.username}#${guild.owner.user.discriminator}

#

GuildMember wraps User instead of extending it

quiet bobcat
#

Oh ok

glossy sand
#

kind of annoying

quiet bobcat
#

Yeah

#

Yeah that worked

#

Thanks

glossy sand
#

if you wanted to though, you could extend the prototype of User for convenience

#
User.prototype.toUserDiscrim = function() {
  return `${this.username}#${this.discriminator}`;
};
#

then you would be able to just call guild.owner.user.toUserDiscrim()

quiet bobcat
#

Yeah

uncut slate
#

I'd make it a getter

#

bit easier

glossy sand
#

eh too used to java

uncut slate
#

no u

fervent goblet
#

No u

quiet bobcat
#

no me

earnest phoenix
#

My. Mute. Command. No. Work

#

( yes

#

For a test bot

#

I copied someones mute code from somewhere

#

I want to see if it works

quiet bobcat
#

First of all that's your kick command. And guildMember shouldn't be there

earnest phoenix
#

member doesnt work either.

#

same error with member

quiet bobcat
#

hmm

earnest phoenix
#

oh yeah

#

kick

#

@quiet bobcat So no idea?

quiet bobcat
#

No not really

earnest phoenix
#

I have to define it

#

But

quiet bobcat
#

Yeah

earnest phoenix
#

On the other code it wasnt defined

#

but the other code worked?!

quiet bobcat
#

Do you know what discord.js version it was?

#

Could be an older version

earnest phoenix
#

but it works now still

#

I dont want my bot to get kicked if its offline for long :D

quiet bobcat
#

It wont if its off for like a day or two

earnest phoenix
#

So in that time someone will help me

#

i think

quiet bobcat
#

Yeah

#

Maybe put // in front of every line of that command

#

to make it inactive

#

and then launch the bot

earnest phoenix
#

@quiet bobcat i deleted it

quiet bobcat
#

That works too lol

earnest phoenix
#

i can find another dev who can help me in 2 days

naive hazel
#

Shouldn't this work .addField("Joined at: ", message.author.joinedAt)

uncut slate
#

joinedAt.toString()

thorny hinge
#

@quiet bobcat "Maybe put // in front of every line of that command" or just do /* in one line and */ in the other Thonk

pale light
crystal void
#

😹

thorny hinge
#

How can I get data from my bot to a website?

#

My website

fervent goblet
#

make an API

#

I could help you @brittle nova

#

@thorny hinge*

thorny hinge
#

when you tag the wrong atmg GWbinMmlol

earnest phoenix
#

Hallo

#

please command "118 Server usage"

thorny hinge
#

The only way is api? @fervent goblet GWragMonkaS

#

Pls

fervent goblet
#

or websocket server

#

so

#

what data do you want to your website?

thorny hinge
#

I wanna directly get connection from the website to the bot - and be able to access all data

#

I'm making a control panel

fervent goblet
#

oh I can help with that

#

anyway, are you gonna host the site on the same machine as your database(s)?

thorny hinge
#

No

thorny hinge
#

@fervent goblet GWrjkKappaPeek

#

Lol idek where to start

icy lynx
#

I think that's a bad thing

#

Since that means you want to read others' message

#

But yes, you would have to use either Discord API or make your own API with the bot

thorny hinge
#

That's not what I'm using it for

#

I just wanna have access to the bot, the way I have access to it in my code - but on my website

icy lynx
#

"access to the bot" explain

#

I thought by that, you meant checking all servers he's inside, check their messages, etc

thorny hinge
#

How else can I explain Thonk

#

Uh

#

The bot object I suppose

#

Like the bot itself

inner jewel
#

you'll have to make an API

thorny hinge
#

Reeeeee

icy lynx
#

Shouldn't be hard

livid mango
#

@thorny hinge 1. have the bot script host a http server

shy rose
#

Ay so do i 😛 gives you really good control of content with response to what the bots upto

hallow wing
#

no matter what I do the servercount thing isn't working

stone kiln
#

what lang?

hallow wing
#
    async def on_ready(self):
        await aiohttp.ClientSession().post('https://discordbots.org/api/bots/' + str(self.user.id) + '/stats', json={"server_count": len(self.servers)}, headers={'Authorization': 
            dbltoken})

(I've tred like three different things from #312614469819826177)

#

py

stone kiln
#

i can see that

#

from the thing you send

#

@hallow wing you haven't defined dblToken
that is supposed to be the token from your bot page on DBL

hallow wing
#

it's defined elsewhere

stone kiln
#

ah

hallow wing
#

and imported

#

😛

stone kiln
#

i would have used a db for the tokens

#

but that is just me

hallow wing
#

Never used a database before otherwise I would've x.x

#

am still p new to coding

stone kiln
#

why not start simple and start with JSON and expand later to a DB

hallow wing
#

never crossed my mind ig

#

other that any clue why it keeps erroring out?

stone kiln
#
    async def on_ready(self):
        await aiohttp.ClientSession().post('https://discordbots.org/api/bots/my_bot_id/stats', json={"server_count": len(self.servers)}, headers={'Authorization': 
            dbltoken})```
#

where my_bot_id = your bots id

#

if you don't know that out of your head just head over to your bot page 😉

hallow wing
#

or I can just right click and grab it to xD

stone kiln
#

true that

#

btw question what did you define your client as self or something else?

hallow wing
#

cx

#

self

stone kiln
#

okay

hallow wing
#

wot

#

._.

stone kiln
#

wew

#

doesn't see the json

hallow wing
#

throws computer out window

#

hate for api's intesfies

stone kiln
#
    async def dblpost(self):
        """
        This async function does a post of server and shard count to discordbots.org.
        """
        if self.config['dbl'] != "":
            headers = {
                'Authorization': self.config['dbl'],
                'Content-Type': 'application/json'
            }
            data = {
                'server_count': len(self.bot.guilds),
                'shard_count': len(self.bot.shards)
            }
            i = await self.bot.application_info()
            req = await self.bot.session.post(f'https://discordbots.org/api/bots/{i.id}/stats',
                                              data=json.dumps(data), headers=headers)
            if req.status == 200:
                logging.info('poster[dbl]: done')
            else:
                t = await req.text()
                logging.error(f'poster[dbl]: oops (code {req.status})')
                logging.error(f'poster[dbl]: response: {t}')
        else:
            pass```
try this
hallow wing
#

I don't have shards but oki

stone kiln
#

¯_(ツ)_/¯

#

for the future

#

make stuff future proof

#

always help in the later stages/run

#

if you don't have shards it will just give 1

hallow wing
#

o.o I could never see neko on 1000 servers let a alone 2000 which is when you need to start sharding

stone kiln
#

i recommend start sharding at 1000

#

do it before 2000

hallow wing
#

oh?

stone kiln
#

it goes fast

hallow wing
#

I'm a long way from taht

#

*that

quasi marsh
#

It's better to be prepared

stone kiln
#

^

neon pasture
#

If I was you I would start sharding at 1K

quasi marsh
#

Say your bot gets a sudden boost

#

I already support sharding even at 200 guilds

stone kiln
#

same

quasi marsh
#

It doesn't shard, now, but it can if needed

stone kiln
#

i already am sharding GWbinMmlol

hallow wing
neon pasture
#

I supported sharding at 1000

#

was a bit to late

stone kiln
#

yeah

quasi marsh
#

And if you use discord.py rewrite you can just use the AutoShardedClient

#

Which seems nice

hallow wing
#

on async sadly

neon pasture
#

with Eris it's almost the same

quasi marsh
#

There is an async2rewrite converter on pip

neon pasture
#

What lib do you use Winter?

stone kiln
#

with C# it's hell

hallow wing
#

^

quasi marsh
#

I used that and checked any things I need to change

#

I'm not gonna switch back anymore

stone kiln
#

server counts 10/10

hallow wing
#

so I don't think I have logging

#

so I changed it to print

#

that should still work rihgt?

stone kiln
#

yeah

hallow wing
#

iurhgfuesdsgdsa

#

FUCK IT

#

DISCORDBOTLIST DOESN'T NEED TO KNOW HOW MANY SERVER'S I'M ON

#

I KNOW AND THAT'S ALL THAT MATTERS

stone kiln
#

no cert then

#

just a normal bot dev

hallow wing
#

¯_(ツ)_/¯

#

maybe next time

stone kiln
#

maybe

hallow wing
#

welp

#

I think I know why that code doesn't work

#

I'm on 3.5.2 xD

stone kiln
#

agh

hallow wing
#

ikkk

#

I'm recoding from scratch soon

#

but I was trying to get this done first

#

guess I'll have to get certifed after re-write

stone kiln
#

maybe

hallow wing
#

meep

#

22 upvotes in 2 days 😄

stone kiln
#

damn

hallow wing
#

fill your ears with delicious octaves

stone kiln
#

k

hallow wing
#

xD

#

I love the way I word stuff sometimes

hazy bone
#

em

#

HI

uncut slate
#

hi

earnest phoenix
#

if anyone have a command for bot log guild on join tage me, i need a command for the logs example (If my bot join a guild my bot send a message in a channel in my server with all infos guild)
idk if you understand

quasi marsh
#
@client.event
async def on_guild_join(guild):
if system_channel is not None:    
    await guild.system_channel.send("Your info here")
else:
    guild.text_channels[0].send("Your info here")
#

I think this should work

#

Basicly

#

When bot joins guild

neon pasture
#

don't spoonfeed

quasi marsh
earnest phoenix
quasi marsh
#

Look in the documentation

earnest phoenix
#

ok thanks

quasi marsh
#

It depends if you use rewrite (which i recommend) or async

#

rewrite has a lot more features but is "technically" unstable

earnest phoenix
#

okay

#

yes

short siren
#

http://prntscr.com/hpocjx Basicaly i'm using discord.js but i dont get how peole do this like adding the image and text is it a npm i tried the canvas npm but its really hard and i couldn't find a tutorial or something on youtube is there another way?

Lightshot

Captured with Lightshot

weak parrot
#

Stackoverflow bloblul

bitter sundial
#

when you need a youtube tutorial to use an npm package

#
#

just in node

#

and not a browser

#

just read docs you dont need a tutorial

inner jewel
#

what

lethal sun
#

How to make a bot to send a dm to a specified thats not in the guild where the command was executed in? JavaScript - Discord.js

bitter sundial
quiet bobcat
lethal sun
quiet bobcat
#

But yours reaches the edge

#

Mine doesn't reach the edge

lethal sun
#

wow its white under

#

wow

quiet bobcat
#

lol

umbral pelican
#

mmm background shapes memes

crystal void
#

ikrr

uncut slate
#

ur a background shape meme

crystal void
#

ooooh... hard one right there 😹

naive hazel
#

Is there a way to do this module.exports = message => {} but with more.. arguments? like module.exports = message, ready => {}

uncut slate
#

yes

#

()

#
module.exports = (message, ready) => {}
naive hazel
#

Oh it's like that

#

Thank you 😄

short siren
#

I'm trying to get it to give me a list of people who have upvoted my bot https://discordbots.org/api/bots/363695248997613575/votes but i'm not sure how to do it with the api key and stuff has anyone got a example so i just want it to console.log the result of the page but im not sure how i would get past auth

#

I have this so far js request('https://discordbots.org/api/bots/363695248997613575/votes', function (error, response, body) { .set('Authorization', key) var ParsedBody = JSON.parse(body); console.log(ParsedBody) }); key is defined as my api key

#

if i remove the .set i get unautharized

#

how do i set it

bitter sundial
#

you need to set it before the callback

thorny hinge
#

So if I have this string: hello hello hello, how can I get all the "hello"'s and access each one with an array like hello[0] or hello[2] Thonk

glossy sand
#
'hello hello hello'.split(' ');
earnest phoenix
#

hi

thorny hinge
#

@glossy sand im using regex to find the words

fervent goblet
#

amtg weren't u the one asking for an api?

thorny hinge
#

Yeah yesterday

fervent goblet
#

den dm

inner jewel
#

using regex to find the words

#

wat

thorny hinge
#

What

topaz fjord
#

How to check for dead shards

thorny hinge
#

The word im trying to find is not actually hello

topaz fjord
#

?

glossy sand
#

you can

let str = 'hello hello hello';
let m, arr = [];
while (m = /\bhello\b/g.exec(str)) {
  arr.push(m[0]);
}
console.log(arr); // => ['hello', 'hello', 'hello']
topaz fjord
#

,anyone?

glossy sand
#

you can also do something stupid with replace like

let str = 'hello hello hello';
let arr = [];
str.replace(/\bhello\b/g, function(m) {
  arr.push(m);
});
topaz fjord
#

@earnest phoenix want to see the code?

fervent goblet
#

Sure

earnest phoenix
#

@topaz fjord yh

topaz fjord
#

wut

naive glen
#

Yo can anyone help me with this white space at the bottom of my page?
(The red boxes highlight elements)
(The body element has the background set to well, the giant image)
Apparently the white space isn't in the body Thonk

#

(This is when zoomed out ^)

kindred bluff
#

Hey does anyone know of a node.js library that would allow me to post the number of servers my bot is on?

fervent goblet
#

20000 examples

kindred bluff
#

Oh lol thanks

topaz fjord
#

the pay command thats given me problems

earnest phoenix
#

whyhyyyyy

#

are you not using rethinkdb

topaz fjord
#

wut

#

cus

#

i just started with db's

earnest phoenix
#

and mysql is the worst place to start

topaz fjord
#

Ill upgrade to rethink

#

in my next update

fervent goblet
#

fuck rethonk

#

use mongo

earnest phoenix
#

I suggest you do it ASAP before you get any serious data

fervent goblet
#

MONGO

earnest phoenix
#

YOU WOT

fervent goblet
#

YOU WOT

topaz fjord
#

so

#

any ideas....

fervent goblet
#

MONGO

topaz fjord
#

why its adding wonky af

fervent goblet
#

OVER REthonk

#

btw

#

whats the issue?

topaz fjord
#

so

#

when i first do my pay command and pay someone 1k it gives them 3k instead

#

then i pay them 1k more

#

and it takes 1k from them

#

its being wonky for some reason

fervent goblet
#

LOL

ebon apex
#

Let me take a look at this

#

sec

topaz fjord
#

wait

#

heres a better example

#

of it being wonky

#

and yes

#

it did add 10000 to me

ebon apex
#

Try adding again and then tell me if everyone got the amount you added

topaz fjord
#

how did it jump from 1k to 13k Thonk

ebon apex
#

it looks like that is what just happeendf there

topaz fjord
#

ok

#

i tried to pay the same person again

#

and it wont even give them the money anymore

ebon apex
#

Try your add command to give a user money and see if it adds that amount to all users

#

In that screenshot it looks like it is doing that

ebon apex
#

I have not one clue, make sure all your variables for the numbers are not strings and that the numbers in the database are numbers.

#

Make sure you're fetching the correct user from the database, and make sure you updating the correct user in the database

#

I hate mysql personally, so I cannot help on that side of things.

#

Try logging the results entry and see if the amount is a string or an INT because that would matter as well.

topaz fjord
#

seems like i fixed it

#

@ebon apex

#

so

ebon apex
#

Alright, so everything works now?

topaz fjord
#
            settings.query(`UPDATE eco SET money = ? WHERE userID = ? AND guildID = ?`, [results[0].money + payamount, user.id, message.guild.id])
            settings.query(`UPDATE eco SET money = ? WHERE userID = ? AND guildID = ?`, [rows[0].money - payamount, message.author.id, message.guild.id])
#

its was here

fervent goblet
#

int(results[0])

topaz fjord
#

instead of putting results[0] u put rows[0]

fervent goblet
#

or whatever it is in yo lang

#

is dat py?

topaz fjord
#

since results[0] is the user

#

and rows[0] is me

ebon apex
#

It's JS it would be Number(VALUE)

#

But if you got it

fervent goblet
#

WHATEVER

ebon apex
#

No reason

topaz fjord
#

trying to get everything ready before big update

ebon apex
#

My name?

topaz fjord
#

so kinda stressed

#

noice

umbral pelican
topaz fjord
#
(C:\Users\siddh\Desktop\TurtleBot-Dev-Release\bot.js:35:23) Parsing error: Unexpected token =>
Error: (C:\Users\siddh\Desktop\TurtleBot-Dev-Release\bot.js:35:23) Parsing error: Unexpected token =>
    at getSourceCodeOfFile (C:\Users\siddh\AppData\Roaming\npm\node_modules\eslint\lib\util\source-code-util.js:38:15)
    at filenames.forEach.filename (C:\Users\siddh\AppData\Roaming\npm\node_modules\eslint\lib\util\source-code-util.js:94:28)
    at Array.forEach (<anonymous>)
    at getSourceCodeOfFiles (C:\Users\siddh\AppData\Roaming\npm\node_modules\eslint\lib\util\source-code-util.js:93:15)
    at configureRules (C:\Users\siddh\AppData\Roaming\npm\node_modules\eslint\lib\config\config-initializer.js:165:23)
    at processAnswers (C:\Users\siddh\AppData\Roaming\npm\node_modules\eslint\lib\config\config-initializer.js:288:18)
    at inquirer.prompt.then.secondAnswers (C:\Users\siddh\AppData\Roaming\npm\node_modules\eslint\lib\config\config-initializer.js:536:32)
    at <anonymous>
Determining Config: 0% [------------------------------] 0.1s elapsed, eta 0.0s
#

one other thing

#

im kinda having problems with eslint

fervent goblet
#

code?

topaz fjord
#

there is no code

#

trying to do eslint --init

fervent goblet
#

C:\Users\siddh\Desktop\TurtleBot-Dev-Release\bot.js

#

there's code

#

unless bot.js is now a meme?

thorny hinge
#

So when I do a forEach and run into an error with one of the elements, how can I like uh.. see how many errors I ran into?

#

An example:
[null, "kek", 2].forEach(element=> element.slice(1))
2 of those elements will fail, but how can I make it automatically count how many elements failed

glossy sand
#

there's no built-in way to do it

#

but you can keep a counter and use try...catch blocks

#
let counter = 0;
arr.forEach(thing => {
  try {
    // do something
  } catch (e) {
    counter++;
  }
});
console.log(`${counter} things went wrong!`);
thorny hinge
#

mmm

#

Seems good enough

glossy sand
#

or you can do something stupid like

let failed = arr.filter(thing => {
  try {
    // do something
  } catch (e) {
    return true;
  }
  return false;
}).length;
#

there's always a stupid solution in js

thorny hinge
#

kek

topaz fjord
#

@fervent goblet what about it

#

oh here

cosmic plover
#

counter things went wrong 👌

earnest phoenix
#

huh

earnest phoenix
#

i tyring to think of new webdev projects or just projects overall to work on

#

if anyone got some neat ideas but dont have time ect to do it hmu

#

im bored as all hell

#

i work in the MEAN stack if it isnt obvious and play with stuff like sockets often if that helps

shrewd field
#

hey
can someone help
I have

(node:4) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): DiscordAPIError: Cannot send an empty message
2017-12-20T12:25:12.881945+00:00 app[worker.1]: (node:4) [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.
2017-12-20T12:25:13.025983+00:00 app[worker.1]: message deleted -.
2017-12-20T12:25:13.084845+00:00 app[worker.1]: [ '' ]
2017-12-20T12:25:13.084893+00:00 app[worker.1]: 
2017-12-20T12:25:13.084947+00:00 app[worker.1]: []
2017-12-20T12:25:13.108478+00:00 app[worker.1]: (node:4) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 4): DiscordAPIError: Cannot send an empty message```
#

error

stone kiln
#

you are trying to send an empty message

shrewd field
#

ok

#

i know that

#

but like where and how

#

I don't know

stone kiln
#

show the code

shrewd field
#

all

stone kiln
#

do you even know how to debug

shrewd field
#

not much

north fog
#

use breakpoints

#

no, this should not break your bot

#

but tells the debugger to wait there

winged vapor
shrewd field
#

hello

#

how do I change the bot's playing message to watching?

#

like Luca#0393

uncut slate
#

check pinned messages

shrewd field
#

ok

#

ok

#

thx

bitter sundial
#

lul

shrewd field
#

how do I do the mention prefix

#

hey

#

aretheeryx

#

it doesn't work

#

nothing happens

#

no errors

uncut slate
#

🤷

quasi eagle
#

can someone help me, i have visual studio 2017 on my computer but there is no .NET Core 2.0 only .NET Core 1.1

shrewd field
#

what does that mean

#
   client.user.setPresence({
          status: "online",
          activity: {
            name: "Donut: Rainbow Six",
            type: 0,
            url: "https://www.twitch.tv/discorddonut/"
          }
        })```
#

this is what i did in the ready event

north fog
neon pasture
#

@shrewd field you even know what your doing?

north fog
#

@quasi eagle ^

quasi eagle
#

yea i already installed that

#

but there is an update for visual studio so ill try that first before doing anything more

north fog
#

👍

earnest phoenix
#

Update the

#

Updater

quasi eagle
#

yea the updater is now updated

earnest phoenix
#

Thanks for keeping me updated on the updating of the updated updater updates always welcomed

#

hhehe

quasi eagle
#

xD

earnest phoenix
#

I feel outdated now

quasi eagle
#

oooo the updated updater is fetching the .NET Core sdk update to apply to the updated visual studio

earnest phoenix
#

Updating is updated by the updater up down inside out out date up

#

I'm outdated

topaz fjord
#

Anyone know how to check for dead shards

stone kiln
#

what lang?

topaz fjord
#

Js

stone kiln
#

i know how to do it in C#

#

not JS just yet

#

sorry

topaz fjord
#

:(

woven drum
#

Idk about dead shards

topaz fjord
#

Fuk

north fog
#

dead shards ¿¿

#

like someone shotted down ¿

topaz fjord
#

Shards that don't respond

icy sorrel
#

The way I did it in my own bot is I have earch shard update a record in a database, I can then compared the timestamp to the current time, if it's older than a minute I assume it's dead.

#

You could create a websocket between the shards that allows them to poke each other to see if they're online tho, that would give you a faster response rather than having to wait for the update to happen in the database.

topaz fjord
#

But then how do you fix it?

icy sorrel
#

Depends on why they died

topaz fjord
#

What if it dies cause of a error

#

Would you just restart the bot?

icy sorrel
#

this Thats the stuff I update the database with atm, and currently I'm just using an auto restart script

#

so in the event the bot crashes it will terminate itself and boot itself back up after a few seconds

topaz fjord
#
error catching
/*
    Avoid your bot from crashing on any errors
*/
process.on('unhandledRejection', error => console.log(`unhandledRejection:\n${error.stack}`))
.on('uncaughtException', error => {
    console.log(`uncaughtException:\n${error.stack}`)
         process.exit() //better to exit here.
})
.on('error', error => console.log(`Error:\n${error.stack}`))
.on('warn', error => console.log(`Warning:\n${error.stack}`));
#

So like doing this

icy sorrel
#

I wouldn't kill the process just because you got an unhandled exception :p

topaz fjord
#

Should I kill on error?

icy sorrel
#

If you get an error, just log it somewhere and keep going, if the bot crashes because you didn't catch some error, you can auto reboot it with a small script

#

Naah

#

It's a pretty nice free tool

topaz fjord
#

Is there an eval for killing a shard?

icy sorrel
#

What do you mean?

topaz fjord
#

Like if a shard is unresponsive, could I eval something to auto reboot ot

#

It

#

Like if I have 2 shards

#

And shard 1 is unresponsive

#

Is there something where I can eval on shard 2 to kill shard 1

icy sorrel
#

If it's not responding it would be difficult to run an eval command, using auto-reconnect features from the library you're using should be fine tho.

#

You could close and reopen a shard via another shard, just having it auto reconnect if it disconnected would be a lot easier tho

#

In the event that the bot actually crashes you can have a script auto restart it, otherwise there are no need to over complicate things.

north fog
#

maybe multithreading ¿¿

#

1 thread is the bot itself, other thread looks over thread 1 to see if is death or not ¿¿

fervent goblet
#

supervisor

quiet bobcat
#

Can someone help me? I'm getting this issue that it says this: ```javascript
if (server.dispatcher) {
^

TypeError: Cannot read property 'dispatcher' of undefinedBut it's defined the line above that asjavascript
var server = servers[message.guild.id];```

#

It's discord.js by the way

inner jewel
quiet bobcat
#

Yes and I don't understand why

#

It worked fine before

sullen sonnet
#

Have a friend that posts Tading signals on his discord server i want to duplicate those messages into my own server. Is there a bot for this?
dont mind tipping someone some BTC for the help

earnest phoenix
#

You're coding a music bot? If you are head over to "Coding with Storm" and check out their examples and tutorials

quiet bobcat
#

As said before I'm using discord.js and not C#

earnest phoenix
#

Yeah its js not c# at coding with storm

#

my music code is in js too

sullen sonnet
#

Can someone explain to me what my URL redirect should be to get message.read to work

earnest phoenix
#

Well it was until I updated it

quasi marsh
#

C#

sullen sonnet
#

What URL redirect should i use if i want to use the message.read scope!

#

for the AUth link

quasi marsh
#

Why do you want that scope?

earnest phoenix
#

Oh no

sullen sonnet
#

Because i want to read my friends messages and paste it onto my discord

quasi marsh
#

That's a bit privacy invading m8

quiet bobcat
#

Yeah

sullen sonnet
#

thats not why

#

so its a news discord

#

we do articles

#

He posts mine i post his

#

its not like that we just want to have a bot to post eachothers so we dont have to copy and paste sort of thing

earnest phoenix
#

Violation of ToS reaper

quasi marsh
#

Why doesn't he just send over his article lol?

#

Oh you could just have a bot with !postarticle <url>

sullen sonnet
#

Because he has to be on at the exact same times and we on different time zones

inner jewel
#

you don't need oauth scopes for that

earnest phoenix
#

Fk timezones they suck

quasi marsh
#

Yeah you need to use a bot

#

You could have your bot in UTC, and specify a time to post

quiet bobcat
#

.toUTCString()????

sullen sonnet
#

Problem is basically i need to read the messages off of a public discord server channel and duplicate them into mine do I have to use message.read

quasi marsh
#

No

inner jewel
#

no

#

you don't

#

that won't change a thing

sullen sonnet
#

what can I use instead

quasi marsh
#

Bot's can read any message as long as they have access to the channel

inner jewel
#

a bot

#

we told you already

quasi marsh
#

You need to make a bot and use the bot scope

#

Look up some tutorials online to learn to start coding

inner jewel
#

could use a bot + webhooks

#

to have same name and avatar as your friend

#

on your channel

#

and vice versa

sullen sonnet
#

Assume i couldnt put the bot on both servers what then

inner jewel
#

then give up

earnest phoenix
#

Fail at life

#

Pay someone to code your bot

#

like I do sometimea hehehe

inner jewel
#

there's no point in paying someone to make the bot

#

if you can't add it

#

to the servers

earnest phoenix
#

True unless you keep it to yourself or post a link to it lol

#

so yeah basically useless

sullen sonnet
#

If you guys give me advice on how to do this i can transfer BTC

#

im really keen to get this working tonight

quiet bobcat
#

I wan't to make so the bot sends a message when it's not in a voice channel. But when I try to do that I just get ```javascript
if(server.dispatcher === 'undefined') return message.channel.send("I'm not in a voice channel!");
^

TypeError: Cannot read property 'dispatcher' of undefined``` because the bot isn't in a voice channel.

earnest phoenix
#

That's hydrabolts testing code lol

quiet bobcat
#

What?

#

lol

sullen sonnet
#

Anyone good at discord developement would be keen to give me some advice. I will tip bitcoin or paypal if you like

flint saffron
#

Which wrapper?

earnest phoenix
#

Candy wrapper kay im done booboo

sullen sonnet
#

Do you guys know what trade signals are?

earnest phoenix
#

Hello , this code is not correct because i want the message send pm a guys from warn .. beacause this message send mp from me..

Can you help me ?

bot.on("message", message => {
    if(message.content.startsWith(PREFIX + 'warn')) {
        if (!message.member.roles.find("name", "Warn")) {
            return message.channel.send("Vous avez besoin du rôle **Warn** pour utiliser cette commande.")
        }
        let args = message.content.split(" ").slice(2);   
        var member= message.mentions.members.first();   
        let reason = args.join(" ")    
        message.member.send(`Vous avez été averti. Pour la raison suivante : **` + reason + `**. Dans le serveur : (**` + message.guild + `**).`)
    }
});```

I want the message to be sent to the person who was warn
north fog
#

you sending the message the use that has sended the message

earnest phoenix
#

yeah but i don't want this

north fog
#

look at this line javascript message.member.send(`Vous avez été averti. Pour la raison suivante : **` + reason + `**. Dans le serveur : (**` + message.guild + `**).`)

earnest phoenix
#

yeah

north fog
#

tell me what is does extractly

earnest phoenix
#

How drunk are you?

#

lol

north fog
#

im not drunk, he needs to see it self

earnest phoenix
#

the member is me because is it " var member= message.mentions.members.first();
"

north fog
#

that is false

#

look again

earnest phoenix
#

If this error hasnt been fixed by the time I'm on my computer I'll post my code to warn other's

north fog
#

i give you a hint

earnest phoenix
#

there is "message.guild" ?

north fog
#

message.member.send

earnest phoenix
#

That's a dm

#

But

#

Idk

#

yeah

#

but

#

member is a message mentions first

north fog
#

this will send a message to the user FROM the message

earnest phoenix
#

so me

north fog
#

yes, because you have send that message

earnest phoenix
#

so

north fog
#

you are also creating a variable that is been unused

tawny lava
#

(** + message.guild + **).)` this is incorrect as well

earnest phoenix
#

@tawny lava me is good

tawny lava
#

message.guild.name

#

unless that works

earnest phoenix
#

@north fog AH

north fog
#

did you solve your problem ¿

earnest phoenix
#

So can i read 1 at member ?

north fog
#

yes, because you are looking for a mention

#

the first mention

earnest phoenix
#

Yeah

north fog
#

and i guess it needs to be send to that user that you mention

earnest phoenix
#

yeah

north fog
#

other wise the bot doesnt know what to send

earnest phoenix
#

but

#

i read this

#

Vous avez été averti. Pour la raison suivante : + reason +. Dans le serveur : (+ message.guild +).

#

so he can ?

#

Da fuq google translates

#

@earnest phoenix yeah

#

this is not a problem

#

@north fog and ?

north fog
#

1 sec, also busy in rl

earnest phoenix
#

np

#

Eating XD

north fog
#

i wish i had food

stone kiln
#

he is at internship

earnest phoenix
#

Ahh poop 😐 😐 😐

#

i'm so confused

#

x)

stone kiln
#

XD

#

that is a good thing 😛

earnest phoenix
#

Confuzzled

north fog
#

but its really easy to solve, you are currently sending a message to the author of the message, but you want to send a message to the use from the first mension, so change message.member to <something else> and you really should use the unused variable otherwise you have to remove unused things, it makes the code a mess

earnest phoenix
#

ah

#

idk fuk

north fog
#

im litterly telling you to replace it with member because that is the user you mention to warn

#

and currently the variable member is been unused

earnest phoenix
#

ah

#

so i remplace member = memberone ?

#

(yes im so idiot)

#

We all learn code at our own pace

north fog
#

your codejavascript bot.on("message", message => { if(message.content.startsWith(PREFIX + 'warn')) { if (!message.member.roles.find("name", "Warn")) { return message.channel.send("Vous avez besoin du rôle **Warn** pour utiliser cette commande.") } let args = message.content.split(" ").slice(2); var member= message.mentions.members.first(); let reason = args.join(" ") message.member.send(`Vous avez été averti. Pour la raison suivante : **` + reason + `**. Dans le serveur : (**` + message.guild + `**).`) } });

#

use var member

#

because member is a user

stone kiln
#

let is better

earnest phoenix
#

yes

north fog
#

idc, im no javascript guy, but i know the syntax

tawny lava
#

member is not a user

#

message.mentions.members.first();

earnest phoenix
#

member is = message.mentions.members.first();

north fog
#

i guess it returns the first member from the array

tawny lava
#

a user would be message.mentions.users.first()

stone kiln
#

^

earnest phoenix
#

a

#

i'm so idiot

#

wait

#

i test

#

no

#

this command send me

#
bot.on("message", message => {
    if(message.content.startsWith(PREFIX + 'warn')) {
        if (!message.member.roles.find("name", "Warn")) {
            return message.channel.send("Vous avez besoin du rôle **Warn** pour utiliser cette commande.")
        }
        let args = message.content.split(" ").slice(2);   
        var member = message.mentions.users.first();   
        let reason = args.join(" ")    
        message.member.send(`Vous avez été averti. Pour la raison suivante : **` + reason + `**. Dans le serveur : (**` + message.guild + `**).`)
    }
});```
#

🤦

north fog
#

look again in javascript message.member.send(`Vous avez été averti. Pour la raison suivante : **` + reason + `**. Dans le serveur : (**` + message.guild + `**).`)

#

member is still unused

earnest phoenix
#

ok

#

il change

#

no

#

cannot read property "send"

#

of undefened

#
    if(message.content.startsWith(PREFIX + 'warn')) {
        if (!message.member.roles.find("name", "Warn")) {
            return message.channel.send("Vous avez besoin du rôle **Warn** pour utiliser cette commande.")
        }
        let args = message.content.split(" ").slice(2);   
        var membre = message.mentions.users.first();   
        let reason = args.join(" ")    
        message.membre.send(`Vous avez été averti. Pour la raison suivante : **` + reason + `**. Dans le serveur : (**` + message.guild + `**).`)
    }
});
north fog
#

🤦

earnest phoenix
#

Eeeeee

#

yes

#

i'm so idiot

#

i'm approuve

north fog
#

try changing it to: javascript member.send(`Vous avez été averti. Pour la raison suivante : **` + reason + `**. Dans le serveur : (**` + message.guild + `**).`)
yes i know, spoonfeed, idc anymore

earnest phoenix
#

why member.send ??

#

message.member.send

north fog
#

message.member is the author of the message, and that is YOU

earnest phoenix
#

Oml

#

thx you very much

north fog
#

np

naive hazel
#

Does anyone know anything about making a xp system using node js and mysql?

earnest phoenix
#

Sqlite points system rewritten to xp

#

If you are sending the message to the author why not just do message.author.send()

#

Wait nvm i seen the code am on mobile so is kind of harder

quiet bobcat
#

Uhm this is probobarly really easy but how do I remove the command part like !say from the command itself? I just want it to say args[1] or more

#

Instead of eg command: !say hello everyone and the response being: !say hello everyone I want the response to just be hello everyone

#

I'm using discord.js

glossy sand
#

you can find the index of the first space and take the substring from there

earnest phoenix
#

message.split(" ").slice(1).join(" ")

#

p100 coden

glossy sand
#

that works too, but it's less efficient

earnest phoenix
#

efficiency is for the weak

glossy sand
#

ah you must be an enterprise dev

earnest phoenix
#

yeah x.substr(x.indexOf(" ") + 1) is only 20 times faster

#

small improvement at best

#

just started learning java.... I need some help with something

#

so, I made this function:

//Math.java
public class Math extends Main {
    public int add(int[] numbers) {
        int i = 0;
        for (int num : numbers) {
            i = i + numbers[num];
        }
        return i;
    }
}
#

how do I then use it in my Main.java class?

sick remnant
#
Math math = new Math();
int result = math.add(<number array>);

even tho you most likely want to make that method static 🤷

earnest phoenix
#
Math math = new Math();
int result = math.add([1,2, 3, 4]);
#

that should work should it not?

glossy sand
#

er, java doesn't do array literals like that

#

but you can

int result = math.add(new int[] {1, 2, 3, 4});
earnest phoenix
#

yeah, i got it working

#

thanks guys 😃

glossy sand
#

you have to use that stupid syntax because arrays are typed

earnest phoenix
#

wait

glossy sand
#

also your summing algorithm doesn't quite work

#

think of the java for-each loop like a python for...in loop

#

so you would i += num instead of i += numbers[num]

#

the things you're iterating over are the elements themselves as opposed to the indices

umbral pelican
#

extends Main WaitWhat

earnest phoenix
#

yeah whatever

quasi eagle
#

in Discord.NET how do i get the token to send the server amount

inner jewel
#

save it in a config

quasi eagle
#

?

fervent goblet
quasi eagle
#

yes

#

that is what i am following

#

but it just says "token"

quasi marsh
#

It's on the website

quasi eagle
#

wait does it want the bot login token?

quasi marsh
#

No

fervent goblet
#

nononononono

quasi eagle
#

ok good

fervent goblet
#

well tonks would like that

#

I bet

quasi marsh
#

Go to your bot's page on DBL, click edit

#

Scroll to bottom and click show token

#

That's the one you need for servercount

quasi eagle
#

ok

jovial grail
#

can someone other than myself try setting up this bot? https://github.com/FabricLabs/doorman — not sure it is working, need a second pair of eyes

quiet bobcat
#

Uhm... I don't usually download bots

jovial grail
#

It's one of our devs, he rebuilt an old Slackbot we had for Discord

#

I'm not really a bot dev, so I figured someone else would know what to do with it

quasi eagle
#

in Discord .NET how would i check if a message has a link in it

icy lynx
#

Regex, prob

quasi eagle
#

what does discord count as a link

#

do links have to start with https

#

lets check

#

yes

quiet bobcat
#

Yes https or http are links

quasi eagle
#

hah i found a regex online

quiet bobcat
#

lol

quasi eagle
#

(http|ftp|https)

#

yesss

quiet bobcat
#

xd

earnest phoenix
#

How can i change playing to watching?

#

@everyone ^^ xD

tawny lava
#

read the pins

quiet bobcat
#

I tried the pinned message but it didnt work GWcfcThonk

#

@tawny lava My bot is just online now?

#

sorry for the peng

tawny lava
#

?

quiet bobcat
#

I tried the pinned message

#

But its just online

tawny lava
#

what lib

quiet bobcat
#

d.js

tawny lava
#

I think you need v12 for it to work