#development

1 messages Β· Page 439 of 1

spring ember
#

Oh it's async

lilac obsidian
#

rewrite is ctx.send("message")

#

async

#

is

#

bot.say

spring ember
#

Also it's send yeah

lilac obsidian
#

i know both

#

but i prefer js

earnest phoenix
#

How to make list of user permissions with discord.js?

onyx summit
#

who can help me with enmap?
I sometimes getting "key does not exist" but only sometimes on diffrend guilds

earnest phoenix
#

current code : ```js
var embed = new Discord.RichEmbed()
.setAuthor('user info : ', message.author.avatarURL)
.setTitle("Username : ")
.addField("Roles", message.member.roles.map(role => role.name).join(", "))
.addField("Join date", message.member.joinedAt)
.addField("Nickname", message.member.nickname)
.addField("Last Message", message.member.lastMessage)
.addField("Permissions", message.member.permissions.raw)
.setDescription(message.author.username)
.setThumbnail(message.author.avatarURL);
message.author.send({embed});

#

it doesn't list permissions correctly, can anyone help? πŸ€”

slender thistle
ruby dust
#

does sqlite3 raise any errors when no data is selected with SELECT?

earnest phoenix
#

One message removed from a suspended account.

#

One message removed from a suspended account.

knotty steeple
#

you already defined commandfile

earnest phoenix
#

One message removed from a suspended account.

knotty steeple
#

you must have let commandfile = bot.commands.get(cmd.slice(prefix.length)) twice in your code

#

check

earnest phoenix
#

One message removed from a suspended account.

#

One message removed from a suspended account.

knotty steeple
#

you can only have it once

earnest phoenix
#

can i get some help?

#

One message removed from a suspended account.

#

πŸ€”

inner jewel
#

remove the first two lines

earnest phoenix
#
var embed = new Discord.RichEmbed()
    .setAuthor('user info : ', message.author.avatarURL)
    .setTitle("Username : ")
    .addField("Roles", message.member.roles.map(role => role.name).join(", "))
    .addField("Join date", message.member.joinedAt)
    .addField("Nickname", message.member.nickname)
    .addField("Last Message", message.member.lastMessage)
    .addField("Permissions", message.member.permissions.raw)
    .setDescription(message.author.username)
    .setThumbnail(message.author.avatarURL);
message.author.send({embed});
``` it doesn't lists user permissions πŸ€”
knotty steeple
#

if people can help you they will

#

stop asking

earnest phoenix
#

One message removed from a suspended account.

shy verge
#

yo i heard someone wants free hosting

earnest phoenix
#

One message removed from a suspended account.

#

One message removed from a suspended account.

knotty steeple
#

how to give someone a role discord.js

eternal gull
#

guildMember.addRole(<id or role>)

#

@knotty steeple

#

make sure to check for manage roles perm first

runic cloud
#

you give me an indea for the name of my bot?

shy verge
#

how about The Big Gay

onyx summit
#

How to make a hyperlink?

earnest phoenix
supple owl
#

I'm trying to make it so when someone gets banned/kicked they would get a message by the bot saying that you have been banned/kicked

spring ember
#

why is it :

#

it needs to be sendMessage('ur message')

onyx summit
#

wait no

runic cloud
#

you need msg.author.sendMessage

supple owl
#

but, i want it so it would send it the message to that person

onyx summit
#

node js right?

supple owl
#

yes

spring ember
#

that is not js

supple owl
#

πŸ€”

onyx summit
#

it is

spring ember
#

await message.author.sendMessage('message')

onyx summit
#

nah

spring ember
#

I mean what he wrote

runic cloud
#

i dont use "message" i use "msg"

spring ember
#

what

#

oh wait wait

#

you need to send it to the banned user

supple owl
#

yes

onyx summit
#

@supple owl
kickuser (you have that already, u need it to kick)
kickuser.send("Kicked for gay");

spring ember
#

yes

#

kickuser is a user

supple owl
#

could i put in args into the message?...

spring ember
#

yes

#

the message is a string

runic cloud
#

someone approves or declines my bot? without haste eh ..

supple owl
#

ok, thanks everyone

onyx summit
#

let gay= client.users.get("196214245770133504"); gay.send("ey");

#

like this

#

you dont need the first line if you have the user already

ruby dust
#

it can't send the message to someone that isn't in the server, make sure to send the dm first before kicking

languid dragon
#

@onyx summit i suggest you fix your commands and check them through

#

your bot sent NSFW content through your meme command in a non-NSFW marked channel

#

ur bot bout to get a delete if you dont fix this issue now

onyx summit
#

reddit you asshole

#

ok

#

I will fix sry

#

where did it send?

languid dragon
#

i removed the content

onyx summit
#

hm

#

can you dm me what i look like? I need to know wich subreddit

languid dragon
#

it was literally just a mosaic of porn

onyx summit
#

OH saw that one but did only looked over it an thought okay what is that shitty post

languid dragon
#

idc what it was or how it happened, prevent it, disable the command, remove it completely idc

onyx summit
#

ok

#

@languid dragon hotfixed (just disaled)

short siren
#

Lmao

radiant hatch
#

Lets say you make a file called utils.js, all functions start with modules.export. Lets say you make 2 functions, one called hello and the other called hi. How do you call hello in hi in utils.js.

fleet mason
#
                                               ^

TypeError: Cannot read property 'addRole' of null
    at Request._callback (/home/ubuntu/bot/commands/ROTMGcommands/verify.js:560:48)
    at Request.self.callback (/home/ubuntu/bot/node_modules/request/request.js:186:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> (/home/ubuntu/bot/node_modules/request/request.js:1163:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at IncomingMessage.<anonymous> (/home/ubuntu/bot/node_modules/request/request.js:1085:12)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:111:20)
error: Forever detected script exited with code: 1
error: Script restart attempt #1
``` why do i get this error?
inner jewel
#

no member

#

maybe a dm

fleet mason
#

cant be dm since i have disabled that

#

if (message.guild === null) return;

inner jewel
#

what about webhooks?

#

they don't have members

fleet mason
#

hmm maby

#

how to i stop webhooks from using the command

abstract mango
fleet mason
#

how can i check if the author is a webhook ?

#

@inner jewel do you know?

#

but isent a webhook a part of a bot or?

mental solstice
#

It may just show as a bot, debug your code and check for any differences

fleet mason
#

its weird since it happens random

mental solstice
#

What happens random?

fleet mason
#

the error

#

that it cant apparently find the member

mental solstice
#

Return id the author isbot

#

If*

fleet mason
#

if (message.author.bot) return;

#

thats weird since i check for that as well

mental solstice
#

Idk if a webhook shows as a bot or not.. get an IDE.. VSCode or something and debug

fleet mason
#
                                let role = message.guild.roles.find("name", config.guildsetting.memberRoleName);
                                if(!role) return;
                                message.member.addRole(role).catch(error => {});
                                message.member.setNickname(data.name);
                            };```
#

thats the code

#

but should not the catch error cancel it?

mental solstice
#

No

#

Im not sure with JS. But the code would continue, and error at setNickname aswell

#

Since webhook is not a member

fleet mason
#

yea

#

but im not sure if it is a webhook i thought normal users cant use it

mental solstice
#

What if you add.. if (!message.author) return;

fleet mason
#

idk but i can try and see if theres come there is a error

mental solstice
#

I havent done a ton of debugging with webhooks and definitenly none in JS

fleet mason
#

yea i dont know webhooks at all

mental solstice
#

Could be a hierarchy issue

#

Maybe webhook == server owner, so you cant setNickname

fleet mason
#

no its not the server author

#

i log a lot of things and its just a random person that triggers it

#

so im like wtf

#

its so random aswell

mental solstice
#

Youre getting random webhooks?

fleet mason
#

idk

#

like the command just crashes randomly and fucks the bot up

#

why does it remove the roles? i have no member.removeRole() in my code

mental solstice
#

Are you subscribing to the RoleRemoved event, or whatever it may be called?

fleet mason
#

nop

#

theres nothing that removes the role

#

it just happens

quasi marsh
#

Your bot is the only bot in your testing server?

mental solstice
#

Just wondering if someone else removes a role and your bot detects it

fleet mason
#

no dyno is in it as well its that one logging it

#

but no one in the server is removing roles talked to all the mods

quasi marsh
#

You can check your audit log

grizzled totem
#

audit logs?

quasi marsh
#

It will show who did it

mental solstice
#

Server settings

fleet mason
#

good idea i will check it now

inner jewel
#

@fleet mason just check if member or guild is null return

#

or actually just member

#

on dms member is null as well

fleet mason
#

so if (!message.member) return;

#

lol ok so i checked the audit log but i cant fin any log with removing the role... and yes the bot removes the role because it adds but the role dosent get added and its in the audit log that it adds the role πŸ˜•

solemn valve
#

hi i am trying to code my first bot, i downloaded visual studo and am following a youtube tutorial but i seem to be missing something from my installation package

#

the code i am copying is not finding the object it is calling for

#

using Discord;
using Discord.Commands;

#

it cant find discordclient

grizzled totem
#

why not use a codeblock

solemn valve
#

sorry its been a long time since i coded anything what are you suggesting?

fleet mason
#

use 3 ` before and after code

#

thats the codeblock

shy verge
#

what's the error

grizzled totem
#

```
your code here
```

your code here
solemn valve
#

` class MyBot
{

    DiscordClient discord;

    public MyBot()
    {
        discord = new DiscordClient(x =>
            {
                x.loglevel = LogSeverity.Info;
                x.Loghandler = Log;
            });
        
    }

    private void Log(object sender, LogMessageEventArgs e)
    {
        Console.WriteLine(e.message);
    }
}`
shy verge
#

error please

grizzled totem
#

3 backticks not one

#

smh

solemn valve
#

it cant find the class DIscordclient

shy verge
#

your tutorial is outdated

solemn valve
#

i figured. can someone point me to an updated one or tell me the correct class

#

thanks

#

bbl πŸ˜„

radiant hatch
#
const commands = {
  'ping': (msg) => {
      msg.channel.send('pong');
  }
};

client.on('message', msg => {
  if (msg.content.startsWith(tokens.prefix + 'ping')) {
    commands['ping'](msg);
  }
});
``` I'm trying to add "aliases" to my bot but I'm not sure how I would go about doing that.
mental solstice
#

@fleet mason is it possible someone has your webhook url and is using it?

shy verge
#

@radiant hatch not sure this works in JS but I would create an array of acceptable triggers for each command and check the given keyword against these keywords in your command handler

grizzled totem
#

thats a weird setup too

mental solstice
#

@solemn valve do you actually have the discord libs installed?

shy verge
#

eh, it was the first that came to me

#

@mental solstice his usings would error if he didn't

mental solstice
#

Cant find the class discordclient

#

So im assuming its not installed properly

shy verge
#

but he is using the lib namespaces without error, so the lib is correct

#

problem is that he's using the wrong ones

#

and 1.0 forward it's DiscordSocketClient now

solemn valve
#

@mental solstice yes Discord.net discord.net.commands and discord.net.core

mental solstice
#

Yeah, try renaming to DiscordSocketClient

solemn valve
#

ok

shy verge
#

no don't

#

you need to use Discord.WebSocket first

solemn valve
#

im gonna watch the updated tutorial

#

so i ask as few unnecessary questions as possible πŸ˜„

shy verge
#

do you know c#

mental solstice
#

If he did.. VS would recommend he import WebSocket.. but yes.. learn c#

shy verge
#

like at all

solemn valve
#

i used to code in C++ and JS

#

like a long time ago

#

conceptually it doesnt look so different i just have to go slow and reacclimative

#

acclimatize

#

actually i used to code in delphi

#

prob noone here even knows what that is

#

πŸ˜„

shy verge
#

well funny thing

#

C# is a lot easier than cpp

#

.NET can do lots of things for you

solemn valve
#

ill start over and watch this tutorial and then be back

grizzled totem
#

so i have this code

if (user.highestRole >= msg.member.highestRole) return msg.reply('the user your trying to kick has an equal or higher role than you.');
``` it should prevent users being kicked if they have an equal or higher role to the user their trying to kick. but its preventing me from kicking any users, even if they have a lower role
mental solstice
#

Are roles like a list? Starting at 0?

#

Meaning you want your role# to be lower

grizzled totem
#

uh i dunno

solemn valve
#

the new tutorial tells me to create the project using .net framework and i only.see .net core

#

back to the installer?

mental solstice
#

Console application.. not inside .net core

#

If thats not an option.. then yes

solemn valve
#

yes it has only console app .net core

#

no console app for .net framework

knotty steeple
#

TypeError: fn.bind is not a function ?

grizzled totem
knotty steeple
#

im just trying to eval msg.guild.channels.find('name', 'mod-log')

mental solstice
#

Oh

#

Lol highestRole doesnt return a number

grizzled totem
#

i know now

#

its a role

#

gotta use .position

solemn valve
#

ugh the installer doesnt want to work, says cant install to a non empty directory

#

do i have to do the whole thing over again?

buoyant oak
#

nvm

queen violet
#

@knotty steeple what lang

#

lib

knotty steeple
#

discord.js

grizzled totem
#

msg.guild??

#

msg.guild.channels

solemn valve
#

ok i need to install .net workload somehow i didnt

mental solstice
#

Nevermind just read docs

solemn valve
#

do i need to uninstall studio? when i try to add the workload it wont add it to the current directly

vital lark
#

need some help with discord.js πŸ‘€

#

no ok

mental solstice
#

Not sure nzranger.. all the .net stuff should have been default with installer

solemn valve
#

not sure if i install a new instance of studio with just .net that will work

knotty steeple
#

ok then how do i find a channel in a guild

solemn valve
#

ok im just gonna blow away the old version and redo it all to be safe

mental solstice
#

Vs2017

vital lark
#

msg.guild.channels.get("channel_id");

knotty steeple
#

i want to find with a name

#

smh

vital lark
#

oof

#

well

grizzled totem
#
msg.guild.channels.find(ch => ch.name === 'name here')```
#

thats what i do

vital lark
#

or that πŸ‘€

knotty steeple
#

ok works

#

thanks

earnest phoenix
#

Can someone help me with something? I'm using the module canvas-constructor to manipulate some images. So far what I'm doing is load one image file using fs.readFile("./path") and it seems to be working fine until I try to edit the canvas by adding a image on top of it with the same width and height then trying to save it using fs.writeFile("./path", image, function(err)... . So far Fs is saving the picture to my root folder as expected but when I open up the jpg file it doesn't have anything in it, what am I doing wrong?

#

Btw canvas is installed and working

#

I've tried to draw rectangles and add text using canvas-construct and it works fine

#

When I view the picture it displays stuff correctly

#

But adding images to the canvas isn't working

#

@shy verge Do you have to have my token when you are hosting?

quasi marsh
#

Not neccesarily, but as he probably has root access over the VPS, he could read it if he wants to

shy verge
#

I configure all home directories to be only readable by their user. I only ever use root to delete users who violate the agreement in the gist.

#

I won't ever take a peek, and neither can anyone else.

earnest phoenix
#

Ok

#

Do I put .gitignore in the .env file?

#

When I upload it to github

inner jewel
#

yes

earnest phoenix
#

Do I name the file .env .gitignore or something?

inner jewel
#

no

shy verge
#

Whatever works, I simply clone the repo into your home directory during intitial setup.

inner jewel
#

you put .env in your .gitignore

#

as in

#

.gitignore .env

shy verge
#

no wait that's for you to do nvm

inner jewel
#

and other ignores

shy verge
#

All I do is install necessary runtimes and set up your permissions, the rest is all up to you.

earnest phoenix
#

So inside a file called .gitignore I put ```
.env
TOKEN=NOSEEINGTHISREEE

inner jewel
#

no

earnest phoenix
#

oof

inner jewel
#

you don't put token in your .gitignore

#

just the file names for files that shouldn't be added to git

earnest phoenix
#

Oh

shy verge
#

You put your token in the .env

earnest phoenix
#

kk

#

So inside .gitignore I put

# dotenv environment variables file
.env
```?
shy verge
#

sounds good

earnest phoenix
#

@shy verge What the heck happened to github

shy verge
#

MS bought it

earnest phoenix
#

Now it sucks

inner jewel
#

no

earnest phoenix
#

I made a repo and I need to do something?

inner jewel
#

MS hasn't even bought it yet

#

literally nothing happened to GH

knotty steeple
#

SqliteError: UNIQUE constraint failed what does this mean?

earnest phoenix
#

Wait what

shy verge
#

it means "lol what how did you get this error"

earnest phoenix
#

How do I upload files on github?

#

There is no option now

inner jewel
shy verge
#

@earnest phoenix commit your stuff to the GitHub repo

inner jewel
#

just use git

shy verge
#

lemme get a good tutorial brb

#

this applies to all git repos

earnest phoenix
knotty steeple
#

oh

shy verge
#

that's quite inefficient, just commit with git cli

night imp
#

you can initialize it with a read.me

#

while creating it

knotty steeple
#

when making repo- do that ^

night imp
#

And drop upload it if you mean that kind of upload

lethal grove
#

Does anyone have experience with pyttanko?

buoyant oak
#

anyone using aiohttp & has experience with upvote rewards please contact me. I'm desperate ;-;

quasi marsh
#

I dont use aiohttp, I run a web server with bottle.py

grizzled totem
#

is there a list of the region names provided by msg.guild.region for devs?

#

the raw ones like sydney

solid cliff
grizzled totem
#

thanks

#

i did find that on the discord dev docs but dunno how to use it so thanks πŸ˜„

#

discord had a london voice region πŸ€”

night imp
#

Anyone having api errors thonkku

(node:1861) UnhandledPromiseRejectionWarning: DiscordAPIError

    at item.request.gen.end (/app/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:71:65)

at then (/app/node_modules/discord.js/node_modules/snekfetch/src/index.js:215:21)

    at <anonymous>

    at process._tickCallback (internal/process/next_tick.js:182:7)

(node:1861) 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: 2)

(node:1861) [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.

#

Resetting token causes them to go away but bot doesn't login

#

ok it is resetting everytime I refresh the page

earnest phoenix
#

lol on my bot i just made this my help menu

***Note*** *Make Sure to Use Prefix Before all Commands*\n**β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”**\n**help** `<Lists All Help Commands>`\n**β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”**\n__**Fun Commands:**__\n\n**battle** `<A Battlegrounds Minigame>`\n**rr** `<Russian roulette>`\n**gamble** `<A Money Gambleing Command>`\n**google** `<A Google Source>`\n**maps** `<Mapping system>`\n**weather** `<Check the weather at your location>`\n**translate** `<translater>`\n**userinfo** `<Shows info about a user>`\n**roll** `<rolls the dice>`\n**β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”**\n__**Informational Commands**__\n\n**bot-owner** `<shows bot owner info>`\n**ping** `<shows bots ping>`\n**β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”**\n**__Admin Commands__**\n\n**say** `<says a message>`\n**purge** `<clears messages>`\n**setprefix** `<changes the bots prefix>`\n**β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”**
mental solstice
#

@night imp do you have a .catch() function.. to handle the unhandled promiserejection?

night imp
#

catching it^

#

it is on login

#

Figured it out, nvm

solemn valve
#

ok ive installed studio again, following tutorial, made .net framework console app project done a few small things, get to the second line of code and bam, "var" is not recognized

#

what am i missing now

#

`using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using System.IO;

namespace translate2
{
class Utilities
{
string json = File.ReadAllText("SystemLang/alerts.json");
var
}
}`

#

string is fine isnt it from the same library

vernal crow
#

You can’t just put β€˜var’. That’s invalid syntax.

solemn valve
#

i was trying to define a variable as type var

#

it doesnt recognise the class

#

and now it does and i didnt touch anything

#

πŸ˜„

#

something is weird

vernal crow
#

Is this C++?

solemn valve
#

C#

vernal crow
#

Okay. I’m a bit more familiar with that.

solemn valve
#

now its undefined again

vernal crow
#

Are you getting any specific output?

pale marsh
#

What is the error exactly?

solemn valve
vernal crow
#

Welcome to Visual Studio Code

solemn valve
#

if im missing a datatype im missing a library

#

or is this just whackl

#

i said it turned blue for a second

vernal crow
#

In my experience with VS Code, it randomly gives me errors and sometimes doesn’t. If it compiles, you’re good and ignore it.

solemn valve
#

then wentback to being undefined

#

so just keep going?

vernal crow
#

Well, make something that should compile. Then run it. If it errors, then we have an issue.

solemn valve
#

ok

pale marsh
#

@solemn valve just don’t use var then and use the type directly instead

solemn valve
#

compiled

#

moving on next tutorial

#

i feel like im back in kindergarten again

#

πŸ˜„

solemn valve
#

lol this guy is all over the place

solemn valve
#

i have a bot online in my server πŸ˜‹

earnest phoenix
#

@solemn valve What do you want to do?

#

I can help

#

Depending on what lang

keen drift
#

better not be javascript GWfroggyJerry

solemn valve
#

i have a bot written in c# but i want to use this api

#

is that possible

#

im trying to make a translator

#

i just got the bot running and online on my server and it recognizes commands

#

@earnest phoenix

earnest phoenix
#

kk

#

im back

#

Ill see

#

@keen drift Shut up

solemn valve
#

πŸ˜‚

earnest phoenix
#

Idk much C#

#

But ill try help

keen drift
earnest phoenix
#

@keen drift I have 2 repot u 2 polik 4 buly

keen drift
#

internet police is on my side GWfroggyJerry

earnest phoenix
#

@solemn valve U there?

#

@keen drift Is C# anything like js?

keen drift
#

lol

#

no

earnest phoenix
#

oof

keen drift
#

more like java

earnest phoenix
#

Oi

#

Just because I don't have Discord Nitro doesn't mean you have to keep using that emoji

solemn valve
#

im here

earnest phoenix
#

kk

keen drift
earnest phoenix
#

Try this @solemn valve

#
using UnityEngine;
using System.Collections;

public class MYCLASSNAME : MonoBehaviour {
const translate = require('google-translate-api');
 
translate('Ik spreek Engels', {to: 'en'}).then(res => {
    console.log(res.text);
    //=> I speak English
    console.log(res.from.language.iso);
    //=> nl
}).catch(err => {
    console.error(err);
});
}
keen drift
#

that's

earnest phoenix
#

Just for testing

keen drift
#

js?

#

promise then and catch is not in Csharp

earnest phoenix
#

oh

keen drift
#

It's rather hard to interface between languages

earnest phoenix
#

Why don't you help him then

keen drift
#

IPC works though

solemn valve
#

can i use that api from c#?

keen drift
#

I'm sure there's one in Csharp

solemn valve
#

or do i have to make a bot in js

earnest phoenix
#

Oi

keen drift
#

this one is .net C#

earnest phoenix
#

Thats the one I was about to post

#

``

#
using RavSoft.GoogleTranslator;
    
    Translator t = new GoogleTranslator();
    string translation = t.Translate ("Hello, how are you?", "English", "French");
    Console.WriteLine (translation);
    Console.WriteLine ("Translated in " + t.TranslationTime.TotalMilliseconds + " mSec");
    Console.WriteLine ("Translated speech = " + t.TranslationSpeechUrl);
#

Wait

keen drift
#

You can also query this endpoint http://www.google.com/translate_t?hl=en&ie=UTF8&text={0}&langpair={1}

earnest phoenix
#

How does C# catch messages?

keen drift
#

catch what message

earnest phoenix
#

boi

#

fetch whenever a message is sent

keen drift
#

in the discord api?

earnest phoenix
#

for C# yes

#

Ill modify the command

keen drift
#

Csharp has event listeners

earnest phoenix
#

So just like js?

keen drift
#

not exactly

earnest phoenix
#

Hey guess what

#

@keen drift

keen drift
#

what

earnest phoenix
#

I finally left glitch

keen drift
#

wow

#

πŸ‘

earnest phoenix
#

Now I get free hosting

keen drift
#

-_-

earnest phoenix
#

Solarys does free hosting

night imp
#

to be fair glitch isn't that bad for small test stuff photoblobs but actual vps always better

earnest phoenix
#

Yep

#

I'm using vps now

keen drift
#

idk what solarys is

earnest phoenix
#

@ Solarys

night imp
#

he is a person

earnest phoenix
#

I'm not pinging him

night imp
#

He did a giveaway for free hosting iirc

keen drift
#

the fidget spinner?

earnest phoenix
#

yes

keen drift
#

oh kek

earnest phoenix
#

kek kek

slender thistle
#

He still does, it seems

earnest phoenix
#

Yes

#

He does

keen drift
#

my vps cost is not that bad, patreon pays for all of it atm

earnest phoenix
#

Lol

slender thistle
earnest phoenix
#

Fishy

night imp
#

I am cheap mmLol I pay for the smallest amount I can

earnest phoenix
#

@keen drift Whats ur bot

keen drift
#

Β―_(ツ)_/Β―

night imp
#

My bot is on a $3/mon vps and it runs just fine, doesn't need anymore

gilded plankBOT
#
Fishy!#6593
Bots <:dblCertifiedDev:401725450470031362>

@coarse carbon dblCertified

keen drift
#

@night imp Yeah my is about $3.50

night imp
#

No need to buy extra power for an engine that uses half of it

earnest phoenix
#

Mine is about free

slender thistle
keen drift
#

hmm, depends

#

I think this is development related, but we can

night imp
#

This is about bot development but I guess we could

solemn valve
#

i dont see ravsoft.googletranslator in packages

#

only ravsoft.stringparser

keen drift
#

Try querying http://www.google.com/translate_t?hl=en&ie=UTF8&text={0}&langpair={1}

solemn valve
#

sorry i need it dumbed down a little more than that

#

i mean maunally that brings to me a webpage

earnest phoenix
#

lol

#

No

#

You don't use the link to go to the website

solemn valve
#

no i figured that i dont know how to call a website from inside c# yet and if im hard calling a website i need to understand the parameters

#

and how to call one

#

πŸ˜„

keen drift
#

why u pinging me with that

earnest phoenix
#

I pinged u about the thing above it

gilded plankBOT
#

User not found

earnest phoenix
#

Ik this is probably ez

#

But how do I make it say watching for the activity?

solemn valve
#

so that package i posted is only for js ? i cant call it from c#?

earnest phoenix
#

yes

grizzled totem
#

@earnest phoenix what lib?

earnest phoenix
#

well

#

Me?

#

Discord.js

grizzled totem
#
client.user.setActivity(`text here`, { type: 3 });
earnest phoenix
#

K thanks

grizzled totem
#

0 is playing, 3 is watching, can't remember the other two

earnest phoenix
#

kk thanks

keen drift
#

@solemn valve You can, but you don't want to

solemn valve
#

ok

#

ill try some of these other packages. how do i tell if they are c# and where is the documentation?

#

im using visual studio

#

so all langs i assume are showing up

#

that node.js package is here for example

keen drift
#

oh, it doesn't say what lang?

#

you know it's js when it's less object oriented

solemn valve
#

not that i can tell. some have stuff in the description but it doesnt seem like i can search for only c# packages

grizzled totem
#

how do you get a users status and show an emoji based on it?

#

like dnd, idle etc

keen drift
#

@grizzled totem what lib

grizzled totem
#

discord.js

keen drift
#

<User>.presence.status

grizzled totem
#

i figured that but how do i show a custom emoji based on it?

keen drift
#

if (theStatus === 'online') { /** show online emoji **/ }

grizzled totem
#

like if (user.presence.status === 'online') { msg.channel.send(onlineEmoji); } this but more compact and for all of them

keen drift
#

use switch then

grizzled totem
#

yeah but do i have to do that code and repeat it for all of them?

#

switch?

keen drift
#

switch case

#

look into it

solemn valve
#

can i make a seperate class in js that does all the interaction with the API i was shown and then call it from C#?

keen drift
#

@solemn valve Yeah with IPC, which is not fun to work with as they have limitations

solemn valve
#

but its just a string in and string out right?

keen drift
#

it's not going to be simple as function calls

grizzled totem
#

ok

solemn valve
#

ok

keen drift
#

IPC you need to listen for the messages on both side, process them and then send back, then process it to figure out what function called it

#

then callback to that function

solemn valve
#

no thanks

#

you lost me at not simple

keen drift
#

πŸ˜›

#

so either stick with C# all the way

#

or switch to js for everything

#

like I said there's an URL you can prob call to

#

u just have to learn how in Csharp

solemn valve
#

i have another url as well

#

look at this one

keen drift
#

make use of it

solemn valve
#

but without documentation

#

i have no idae what im doing

solemn valve
#

cool so i have to work with this api externally right

#

theres no package to install

keen drift
#

can't imagine there's a package for simple stuff like this

solemn valve
#

ok

#

so now i just need to find out how to make a web call and receive a response in the form of a file, read it and write it

keen drift
#

pretty much

solemn valve
#

theres a tutorial on that page ill check it out

#

thanks

wild tide
keen drift
#

no idea, you should prob catch all your promises

wild tide
#

hmm

earnest phoenix
#
@client.event
async def on_member_join(member):
    embed = discord.Embed(colour=0x318CE7)
    guild = member.guild
    await client.send(member, "content")
    embed.add_field(name="content", value=guild.name, inline=True)
    embed.add_field(name="content", value=guild.id, inline=True)
    embed.add_field(name="content", value=guild.created_at, inline=True)
    embed.add_field(name="content", value=guild.region, inline=True)
    embed.add_field(name="content", value=guild.owner, inline=True)
    embed.add_field(name="content" value=guild.member_count, inline=True)
    embed.set_author(name="content"+guild.name)```

```py
AttributeError: 'Client' object has no attribute 'send'
``` πŸ€”
earnest phoenix
#

hi

#

help

grizzled totem
#

ask your question lol

#

what are the raw presences 0 to 3?

solid cliff
#

0 = playing, 1 = streaming, 2 = listening, 3 = watching

grizzled totem
#

thanks πŸ˜„

winged bone
vernal sorrel
#

2 secs

#

couldn't you just get the first index

#

0 index

slender thistle
#

@earnest phoenix async or rewrite?

winged bone
#

@vernal sorrel talking to me ? πŸ€” Wouldn't know how to put it in js/jquery either way

vernal sorrel
#

yeah

winged bone
#

yea my experience in this area is fairly low

vernal sorrel
#

mhm

#

nvm

ruby dust
#

what will happen if I will try to update a non-existant data with sqlite3?

earnest phoenix
#

@slender thistle rewrite

slender thistle
#

member.send then

spring ember
#

umm probably better to do:python if not user.dmchannel: await user.create_dm() await user.dmchannel.send(message)

ruby dust
#

member.send is a lot easier Thonk

#

it will create the dm channel anyway

spring ember
#

yeah I am stupid

#

it basically does the same

simple bramble
#

I've asked this question about a week ago, but i still cant seem to work it out. basically i have an ask command, which anyone can use to ask a question to a server staff member about anything, and a setup command, which only an administrator can use, and all it does it set the channel that the questions will be asked in.

#

for the setup command, it's gonna be /AJ/setup <#channel>

earnest phoenix
#

Can you send the code of the command?

#

We can't help you without any code.

simple bramble
#
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Text;

using Discord;
using Discord.Commands;

namespace AssistantJoe.Core.Commands
{
    public class Setup : ModuleBase<SocketCommandContext>
    {
        [RequireUserPermission(GuildPermission.Administrator)]
        [Command("setup" + Context.Client.GetChannel)]
        public async Task HelpAsync()
        {

            EmbedBuilder embed = new EmbedBuilder();

            embed.WithTitle("Command Coming Soon!");
            embed.WithDescription("");
            embed.WithFooter($"{DateTime.Now}");
            embed.WithColor(Color.DarkBlue);

            await ReplyAsync("", false, embed.Build());

        }
    }
}
#

its the + Context.Client.GetChannel

earnest phoenix
#

The command does nothing.

#

It just says Command Coming Soon!

simple bramble
#

ik

restive silo
#

dont do it like that, take the Channel as argument of the Command

simple bramble
#

im trying to figure out how to make it to set the channel

earnest phoenix
#

Then take the Channel as the argument.

restive silo
#

instead doing [Command("setup" + somearg)] do public async Task HelpAsync(SocketChannel channel)

simple bramble
#

ok

restive silo
#

this will take a SocketChannel as argument

simple bramble
earnest phoenix
#

show the code now pls

simple bramble
#

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Text;

using Discord;
using Discord.Commands;
using Discord.WebSocket;

namespace AssistantJoe.Core.Commands
{
    public class Setup : ModuleBase<SocketCommandContext>
    {
        [RequireUserPermission(GuildPermission.Administrator)]
        [Command("setup")]
        public async Task HelpAsync(SocketChannel channel)
        {

            EmbedBuilder embed = new EmbedBuilder();

            embed.WithTitle("Alright! You are set up!");
            embed.WithDescription("All questions will be posted in " + Context.C);
            embed.WithFooter($"{DateTime.Now}");
            embed.WithColor(Color.DarkBlue);

            await ReplyAsync("", false, embed.Build());

        }
    }
}
#

wait i found it i think

restive silo
#

Context.C isn't a thing

simple bramble
#

yeah i just realized

earnest phoenix
#

You should use channel

simple bramble
#

i havent finished that part yet

earnest phoenix
#

SocketChannel channel

#

this is the reference to the channel

#

as an argument

#

instead of Context.C use channel.name

simple bramble
#

i didnt realized until i pasted the code that i didnt finish whatever i was gonna out as Context.C

earnest phoenix
#

now, i don't know what language you are coding in, nor the framework you are using, but this should be implemented

simple bramble
#

C#

earnest phoenix
#

mhm

simple bramble
#

is there a way that you can turn it off?

#

like /AJ/setup off

earnest phoenix
#

no, it will interpret off as a channel, and most likely cause an error

simple bramble
#

Oh

onyx summit
#

Can someone tell me a method to detect nsfw content (free, I dont have money) Idk if its an api or lib

earnest phoenix
#

if you want, you can interpret the channel as a string, then get the channel using the string, and if the string == 'off' then do some code

#

@simple bramble

simple bramble
#

ok

earnest phoenix
#

idk how to do it in C# (not that i don't know C#, because i do know C#, but because i haven't worked with the discord api for C#)

simple bramble
#

ok

#

ill see if i can figure it out

earnest phoenix
#

ok

#

ask someone else on the server (that uses the C# api obviously) and maybe they can help you

simple bramble
#

ok

earnest phoenix
#

please don't expect to be spoonfed on this server

simple bramble
#

ik

mental solstice
#

To save myself some reading, what are you having issues with

#

Christian

earnest phoenix
#

He had some issues with the setup command

simple bramble
#

yeah

earnest phoenix
#

Now he's figuring out how to get a channel from a string

#

(and idk how to do that since i'm not working with the discord C# API)

simple bramble
#

i figured out how to setup the channel, but now i want it to be able to be turned off (by an administrator ofc)

mental solstice
#

Using a db i assume?

earnest phoenix
#

he means by prefix!setup off

simple bramble
#

ye

#

although i may need a db when i get to ask command (later on)

mental solstice
#

Ok well u will need a stored boolean so it doesnt change when you restart your code

simple bramble
#

ok

mental solstice
#

Doesnt have to be boolean, could be a string, on or off.. whatever you prefer

simple bramble
#

yeah

#

i think boolean would work the best

mental solstice
#

Yeah less room for human error.. so, someone sets up their channel, then turns setup off?

simple bramble
#

yeah, if they want to turn it off

mental solstice
#

Essentially, when setup is initiated, all stats for that server are stored.. askChannel(even if null, easier to change if it exists in the DB table), Setup(true or false).. etc

simple bramble
#

ok

#

where would i put the boolean

mental solstice
#

In the table with the server its connected to

simple bramble
#

ok

mental solstice
#

What all do you need stored? Guild ID, AskChannel ID, and Setup?

simple bramble
#

yeah, thats all

mental solstice
#

So best to have a command that stores all those, however u choose to start it

#

Is that with the setup command?

simple bramble
#

yes, with the setup comman

mental solstice
#

When they set up..INSERT INTO sqlTable.. Context.Guild.Id, argumentAskChannelName, SetupTrue

#

Something along those lines

simple bramble
#

yeah

mental solstice
#

To turn setup off, you would simply query the db to change the boolean value WHERE GuildId = Context.Guild.Id

simple bramble
#

ok

mental solstice
#

Then if someone types setup command, retrieve the value of the Setup boolean, and if true, let them set up, if false tell them to piss off

simple bramble
#

yeah, and if they turn it back on, then they would just /AJ/setup <#channel>

mental solstice
#

Ok, and that is the ask channel?

simple bramble
#

yes

earnest phoenix
#
 await client.change_presence(activity=discord.Activity(type=ActivityType.streaming, url='https://www.twitch.tv/bot', name="?help /|\ Cloudy"))```

`module 'discord' has no attribute 'Activity'`
#

πŸ˜…

simple bramble
#

?

mental solstice
#

So what in the discord aspect do you need help with? Most of your code will be db queries

solemn valve
#

@mental solstice i got a bot online and taking commands πŸ‘

#

can somone point me to a C# .net framework tutorial for calling a url and doing something with the return

inner jewel
#

so doing an http request?

#

google should have many tutorials

solemn valve
#

yeah with http

#

but finding an actual tutorial for it is pretty hard to find. when you google anything like that it returns mostly results for creating webpages in asp.net

#

maybe help me define what i am searching for better

mental solstice
#

Yeah it took me a while to find stuff for http requests. SOF will be your best bet, i cant really say there is a good tutorial ive found

earnest phoenix
#

@solar vigil message = message.lower()

mental solstice
#

Just HttpClient, adding headers and getting responses

solar vigil
#

AttributeError: 'Message' object has no attribute 'lower'

slender thistle
#

Unless message is an object

#

message.content.lower()

solar vigil
#

hm

earnest phoenix
#

msg = message.content.lower()

solar vigil
#

Also, can you tell a function to await itself?

#

'Cause I'm writing with just the discordpy library

earnest phoenix
#

async def function()

solar vigil
#

yeah

earnest phoenix
#

then await function()

solar vigil
#

Is there any way to automate that second await though?

slender thistle
#

Afaik, there is no way to make the function await itself

earnest phoenix
#

nope

solar vigil
#

Oh well.

ruby dust
#

what would be the best way to return a list rather than a tuple when trying to fetchall() the data via sqlite3?

#

or any type of fetching data that I'm not aware of

slender thistle
#

list(cursor.fetchall())

ruby dust
#

wait what

#

that's a thing? Thonk

slender thistle
#

Yes

solar vigil
#
async def is_command(command):
        if message.content.startswith(prefix+command):
            return True
#

Having a problem

#

in that it wants to be awaited

#

can I define it without asyinc?

earnest phoenix
#

no

solar vigil
#

Apparently I can

#

sometimes I should just try things before asking.

#

I pressed ctrl+s after writing that.

ruby dust
#

so that basically forces it to fetch as a list, just like you would force a string with str()?

slender thistle
#

Yes

ruby dust
#

good to know

mental solstice
#

@solemn valve i responded above, i have a couple examples i was working with not long ago

#

When i get to pc, i can help you out with sending a request.. and if youre gonna be getting into this sort of stuff, i recommend getting Postman

solemn valve
#

@mental solstice im looking for a tutorial for httpclient

#

is that what you mean

mental solstice
#

Yeah, something along the lines of c# post request httpclient

solar vigil
#

With discord.ext, how do I bot.say to a specific channel, by ID?

restive silo
#

async or rewrite?

solar vigil
#

async

#

to be honest I'm too much of a noob to even know what rewrite is.

restive silo
#

updated version

#

better internal stuff and never features

solar vigil
#

Should I replace all my async with rewrite?

#

I have 28 lines of code right now.

#

;P

restive silo
#

no

solar vigil
#

Ah.

solemn valve
#

@mental solstice does this look right so far?

solar vigil
#

I use async.

solemn valve
#

`public class Translate : ModuleBase<SocketCommandContext>
{
HttpClient _client;

    [Command("tr")]

    public async Task Tr([Remainder]string message)
    {
        await Context.Channel.SendMessageAsync(GetWebTranslate(message));
    }

    private async Task GetWebTranslate(string message)
    {

    }
}`
slender thistle
#

@solar vigil await bot.send_message(channel, "My stuff")

solemn valve
#

and then code the http client stuff inside GetWebtranslate using _client

solar vigil
#

@slender thistle
How do you do it with an ID?

mental solstice
#

Um yikes

#

What are you trying to accomplish?

slender thistle
#

Get a channel object

#

get_channel exists. Docs exist.

solar vigil
#

Where do I find docs.

#

I looked but all I could find is

solemn valve
#
  1. take a call from user: bot.tr russian test
#
  1. send string to webpage api
#
  1. read return file
#
  1. output to channel its called from
slender thistle
#

Ctrl + F -> "get_channel"

solemn valve
#

i have #1 and #4 completed

solar vigil
#

Ah, lots of commands under client.

#

My bad.

slender thistle
#

Isn't everything in async under client

solemn valve
#

i am making a class for #2

#

called translate

mental solstice
#

So write a method to get the request.. pass in the string to translate in an argument. Then you will have to do the request. Would be much cleaner to write a specific method for it, so its reusable. Unless the api has a c# lib.. idk what getwebtranslate is

solemn valve
#

thats my function

#

im asking if the structure is right

#

its passing a string to a specific method πŸ˜„

#

the class translate will be created only when tr command is used correct?

restive silo
#

well you have something off, you pass a Task what is resolving with nothing to SendMessageAsync

solemn valve
#

yeah i know its empty at the moment

restive silo
#

you should pass a string instead or an awaited Task what resolves with a string

solemn valve
#

its going to resolve to a strong

mental solstice
#

It wont be a command and it will return a string probably..

#

So when someone uses the command !translate

#

It will call an outside method, to return the string that will be your message

solemn valve
#

thats what im doing isnt it

#

im calling getwebstranslate when the tr command is used

#

and getwebtranslate will use the instance of httpclient called _client

#

to make the call

#

resolving in a string passed back

mental solstice
#

Oh.. yeah i read that wrong. Yikes, i stopped after i read the [Command ()]

#

Didnt even notice u put another method below the command call

solemn valve
#

🀦

#

so im good?

mental solstice
#

Lol use 3 `

solemn valve
#

ok

mental solstice
#

Instead of 1 when encapsulating code on here

solemn valve
#

now i need to write getwebtranslate() which will use the _client i defined when the class was created, correct?

mental solstice
#

But yes, use _client to get the call.. there are ways of adding headers, if required

#

Yeah

solemn valve
#

that will create a new instance of httpclient everytime tr is called thats correct?

mental solstice
#

Oh. U will need a return in your method

solemn valve
#

sure

mental solstice
#

Public async String

#

I havent done async Task before so im not sure how to make that work when returning types

solemn valve
#

ok just wanted to make sure the logic was correct before i proceeded

#

thanks

#

do i need to dispose of the httpclient at the end of the public class or will it happen automatically

mental solstice
#

Its good practice

#

Garbage collection does a pretty good job tho

#

Oh.. no

#

Since youre creating and instance when the class os created

solemn valve
#

it will be disposed of when its done right

inner jewel
#

no need to worry about disposing of resources

#

unless they come from native code

solemn valve
#

ok

ruby dust
#

in sqlite3, rather than getting a list of tuples with fetchall(), is there any way to get a list of objects instead? trying to select a single column, so I think there is a way that I'm not aware of

slender thistle
#

What objects? GWcfcThonk

#

Select a single column? SELECT column_name FROM your_file;

solemn valve
#

how do i return a string from a private Task method

#

private async Task GetWebTranslate(string message)

#

it defaults to returning a task obect but i can return a different type right

mental solstice
#

Looks like private async Task <string>

safe kettle
#

hi i want to make a bot and idk how

solar vigil
#

Use a search engine

ruby dust
#

if you don't know how, then you won't be able to

solemn valve
#

i didnt know how yesterday

solar vigil
#

That's deep.

ruby dust
#

well if you know a programming language, you'd know how

#

Β―_(ツ)_/Β―

solar vigil
#

I don't like how Python handles file writing.

safe kettle
#

i just want an emoji to pop up when someone says cat related words thats like,,, basic right?

solar vigil
#

That's gonna be a lot of or.

solemn valve
#

go to part 1

safe kettle
#

im going for "cat" or "meow" im a simple person with simple wants

ruby dust
#

building a bot is as difficult as knowing how to use a programming language, basically @safe kettle

safe kettle
#

i dont know where to like, go, to submit the bot, i guess??

ruby dust
#

you already have a bot?

safe kettle
#

no

solemn valve
#

follow the tutorial

ruby dust
#

I don't think video tutorials teach anything at all, people just repeat word for word all the time

safe kettle
#

what i mean is do i have to program the bot IN DISCORD?

solar vigil
#

No.

#

I use Sublime.

safe kettle
#

ok so how do i put it. in discord. i guess

ruby dust
#

again, coding a bot with a programming language, just like you'd code a game

#

anyone can create a bot application/account on discordapp.com/developers/applications/me

safe kettle
#

thank you! i couldnt find this

#

this is what i was looking for lmao

solar vigil
#

I just looked up Discord Bot API and found that.

safe kettle
#

i didnt kno what to look up

#

so

solar vigil
#

I don't know how I've forgotten this

#

but

#

how do you use regexes in python if statements?

#

if string == /regex/?

slender thistle
solar vigil
#

re.search

#

thanks

solemn valve
#

@mental solstice got the call to the website working with issuccessful = yes πŸ‘

solar vigil
#

Congrats.

solemn valve
#

now ijust need to parse the results πŸ˜„

solar vigil
#

Is there a way to alias commands, or do I just define commands to call existing ones :?

mental solstice
#

Nice.. how does it return them? Json.. or

solemn valve
#

in a file that looks like this

#

[[["test","γƒ†γ‚Ήγƒˆ",null,null,2]],null,"ja",null,null,null,1,null,[["ja"],null,[1],["ja"]]]

#

thats not json i dont think

#

?

#

or what type of json format is it

slender thistle
#

@solar vigil Using commands extension?

solar vigil
#

Yeah.

#

Also, please don't ping me 'cause it crashes my Discord and I don't feel like trying to fix it right now.

#

I'll notice the message regardless.

slender thistle
#

@commands.command(aliases=['alias1', 'alias2'])

ruby dust
#

@commands.command(aliases = []) <- inside there define a list of aliases as strings

solar vigil
#

So for

@bot.command()
async def shutdown():
    bot.logout()

I could put

@commands.shutdown(aliases = ['halt', 'stop', etc...])
```?
ruby dust
#

in your case it will just be inside @bot.command()

solar vigil
#

Ah.

#

Okay, got it.

#

Thanks.

solemn valve
#

is that output a Linq query?

mental solstice
#

Yeah, thats definitely not json.. but if its a string.. just split by ,

primal adder
solemn valve
#

@mental solstice look

#

StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Cache-Control: no-store, must-revalidate, no-cache
Date: Wed, 27 Jun 2018 17:55:46 GMT
Pragma: no-cache
Transfer-Encoding: chunked
Server: HTTP
Server: server
Server: (unknown)
Access-Control-Allow-Origin: *
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Alt-Svc: quic=":443"; ma=2592000; v="43,42,41,39,35"
Content-Type: application/json; charset=UTF-8
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Content-Disposition: attachment; filename="f.txt"
}

#

so it is json?

spring ember
#

it's the header of the http request

solemn valve
#

content-type says json?

spring ember
#

is this c#?

solemn valve
#

yes

spring ember
#

ok the Content-type means what the type of the response body is

solemn valve
#

yeah thats what we were looking at

#

this is the file

#

[[["test","γƒ†γ‚Ήγƒˆ",null,null,2]],null,"ja",null,null,null,1,null,[["ja"],null,[1],["ja"]]]

#

must be a type of json?

spring ember
#

it's a json array

solemn valve
#

ok ill look for that thanks

tawdry fox
#

the id of this server is 264445053596991498, but i put it on my list of blocked ids for the leveling system and is the only one that does not work

#

and my head is exploding

#

because i put other server ids and it works

restive silo
ruby dust
#

this one id doesn't work?

tawdry fox
#

yes

#

and because is not working i tried this:

#

if(!user.getMutualGuilds().contains(Shard.getStaticJda().getGuildById("264445053596991498"))) {
code here

}
solemn valve
#

ok new problem

#

when i go to my browser and put in the url i am calling from my program i get this information in the file:

#

[[["test","γƒ†γ‚Ήγƒˆ",null,null,2]],null,"ja",null,null,null,1,null,[["ja"],null,[1],["ja"]]]

#

the output from my program is this

#

[[["Γ£Ζ’ † Γ£,ΒΉΓ£Ζ’","Γ£Ζ’β€ Γ£β€šΒΉΓ£Ζ’Λ†",null,null,0]],null,"ro",null,null,null,0.3104077,null,[["ro"],null,[0.3104077],["ro"]]]

spring ember
#

make sure the text is encoded correctly because it expects a txt file

solemn valve
#

when i change it to translate from english to another language the output is correct from both

#

[[["γƒ†γ‚Ήγƒˆ","test",null,null,2]],null,"en",null,null,null,0.95929444,null,[["en"],null,[0.95929444],["en"]]]

#

its the same problem all the translators we were using is having and why i started making my own

#

so now im up to where everyone else was at πŸ˜„

#

why does it give me back good info when i do it manually but not from the program only when i am translating non english characters to english

mental solstice
#

Manually via webbrowser?

solemn valve
#

yes

#

the file contents are always good

mental solstice
#

Check your request headers in browser, and add them to program.. some websites require certain headers

solemn valve
#

StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Cache-Control: no-store, must-revalidate, no-cache
Date: Wed, 27 Jun 2018 18:16:26 GMT
Pragma: no-cache
Transfer-Encoding: chunked
Server: HTTP
Server: server
Server: (unknown)
Access-Control-Allow-Origin: *
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Alt-Svc: quic=":443"; ma=2592000; v="43,42,41,39,35"
Content-Type: application/json; charset=UTF-8
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Content-Disposition: attachment; filename="f.txt"
}

#

all of those?

ruby dust
#

sorry for bothering you with no help, but I recommend using codeblocks cause it makes them easier to read for everyone πŸ˜„

solemn valve
#

none of that was code πŸ˜‚

mental solstice
#

Status code 200.. isnt that the response?

solemn valve
#

yes

solar vigil
#

Stupid question

#

how d'you check who sent the message

#

that your bot is replying to?

solemn valve
#

from context object

mental solstice
#

Request headers.. different than response

#

Sushi. What lib

slender thistle
#

ctx.message.author is a Member object

vernal crow
#

@solar vigil Which Library?

slender thistle
solar vigil
#

with discord.ext commands

slender thistle
solemn valve
#

@mental solstice i understand the requesting ones differ but i want to make them the same as the response right?

mental solstice
#

No

slender thistle
#

But you need to pass context for that

mental solstice
#

Request is what the website looks at when you send a request.. most browsers send like 3 default headers, website may add more.

solemn valve
#

ok, baby this down for me a bit more. how do i look for what it wants, and where do i write them to

mental solstice
#

Im at work on mobile.. so i wont be much assistance other than telling u what needs to be done πŸ˜‚

solemn valve
#

ha

mental solstice
#

What webbrowser do u use?

solemn valve
#

cliqz but i can load up ie

#

or download whatever is needed

solar vigil
#

How do you retrieve a user ID from a mention?

slender thistle
#

Two variables, replace <@ and > with no character

solar vigil
#

Eh?

#

I'm trying to create a command to blacklist a user with *blacklist @user and grab the ID from the mention in the command.

sullen path
#
String id = mention.replace("<@","").replace(">","");

in java

slender thistle
#

You could take user: discord.Member as a command argument (parameter in async def blacklist)

#

And then, user.id would be what you need

real ginkgo
#

How do you make your command handler async>

#

?

#

...........................................................

queen violet
#

What library

mental solstice
#

@solemn valve can you see all the network activity etc. Via developer tools in that browser

queen violet
#

@real ginkgo

real ginkgo
#

JS.

queen violet
#

On the message event handler add async

#

So like

real ginkgo
#

client.on("ready", async () => {

#

?

queen violet
#

Ye but do that for the message event

real ginkgo
#

client.on('message', async message => {

#

?

solemn valve
#

@mental solstice @sullen path says its because its running from windows

#

y.trans english ΠΊΠΎΠ½Ρ‚Ρ€ΠΎΠ»ΡŒΠ½Π°Ρ Ρ€Π°Π±ΠΎΡ‚Π°

#

ok no bot here

sullen path
#

it's not allowed to speak here

earnest phoenix
#

πŸ‘‹

#

Hello everyone

knotty steeple
#

do you want help with something

earnest phoenix
#

Anyone need help?

#

I can't offer much help because I'm a noob, but does anyone need help?

knotty steeple
#

if anyone needs help they will say, and this chat is kind of unrelated GWcmeisterPeepoShrug

earnest phoenix
#

Β―_(ツ)_/Β―

#

Yea

marsh lark
#

anyone know where abouts i can get the discordbots.org token, might be right under my nose but im blind ;v

onyx summit
#

I need help

#

with pm2

knotty steeple
#

are bots allowed to have Did you mean to use the command <command>?

#

@onyx summit what is it

onyx summit
knotty steeple
#

i know what is pm2

#

just what you need help with

#

smh

#

@marsh lark go the edit page of one of your bots and scroll down then you can find the token

onyx summit
#

xD

knotty steeple
onyx summit
#

So my question was:
I have 2 bots, I want to run both at the same time, also with monitor
So my problem, how to make it restart when it crashes, how to make it restart when a *.js was changed(bearbeitet)
excluded Node_Modules ofc

solemn valve
#

@sullen path i downloaded vmware now i need to download the Linux OS as well?

knotty steeple
#

@onyx summit oh

solemn valve
#

or i need a different api

marsh lark
#

perfect thanks samurai πŸ‘

knotty steeple
#

you know how to start a bot normally? @onyx summit

onyx summit
#

yes

knotty steeple
#

with pm2

#

ok

#

just add --watch at the end

onyx summit
#

no

#

That would restart every millisecond

sullen path
#

@solemn valve you need a linux OS (although I don't think running a bot in a VM is a good idea)

knotty steeple
#

no it wouldnt 🀦

onyx summit
#

ofc I did it

knotty steeple
#

it restarts every time you save a file

onyx summit
#

Bot changes my db and pm2 like RESTART

solemn valve
#

ok so this method is a dead end of rme

#

for me

#

i need a different website or figure out why its returning garbage

#

only from the bot and not when i use my browser

knotty steeple
#

well there is no other way @onyx summit

sullen path
#

🀷

solemn valve
#

back to the headers idea

sullen path
#

probably something with the java charset

#

idk

knotty steeple
#

also when a bot crashes or exits pm2 restarts it GWcmeisterPeepoShrug

onyx summit
#

@knotty steeple Nothing like nodemon ?
I just need nodemon with restart after error (and maybe process optimation)

knotty steeple
#

if the bot had a fatal error that caused it to go down pm2 will restart it

onyx summit
#

yes I know

#

I know there is something to ignore folders, but how to?

solemn valve
#

@sullen path can we use your bot while i am working on mine

sullen path
#

sure

knotty steeple
#

idk i dont pm2 much but i know basic things