node js discord js dashboard on dreamhost

so i have this discord bot and an ejs dashboard for it however im having trouble making it visible on my domain. i host my domain on dream host and i enabled node js on it (its disabled now though) but when i went to run it i ran the program using node . locally. obviously that didnt work i have added the correct configurations to the dashboard and everything. im guessing the problem was that i didnt upload the dashboard files to the server nor ran it on the dreamhost shell or something (not sure if that exists)

How to fix Discord Stuck on RTC Connecting?

RTC Connecting means that the platform is trying to start a voice call. Discord uses the Real-Time Chat protocol to facilitate concurrent communication. So the problem of sleeping on RTC Connecting is network-related.

Visit for this Link – rtc connecting discord


node.js – Discord js Mudar de status automatico para STREAMING e WATCHING ou qualquer outro tipo esta dando erro

Eu ja tentei varios jeitos, mesmo que eu não entenda muito mas eu não consegui reposta de como mudar os meu status de um tipo pro outro sozinho e sem ser randomizado, ja tentei esse aqui e não deu certo ele não reconhece:

client.on(‘ready’, () => {
let setStatus
{ type: ‘STREAMING’, name: ‘test1’, url: ‘’ },
{ type: ‘PLAYING’, name: ‘Tetris99’ },

function setStatus() {
  let randomStatus = status(Math.floor(Math.random() * status.length))
  client.user.setPresence({ game: randomStatus })

setInterval(() => setStatus(), 50000)

este code eu peguei da internet

tools – How do you optimise a session-summary workflow for roleplay sessions on Discord?

To create session summaries, I prefer using congregated individual session data. The data I focus on is the number of events, their corresponding dice-rolls, and chat messages to the next event. This workflow enables me to work faster and more conveniently than having all sessions’ data in one place.

I currently export Discords channel-chat-logs from the beginning to the end of a session via the Discord History Tracker. Unfortunately, the output comes in a format that isn’t easy for transferring the data to an .ods sheet, so I end up copying many things manually, which is more work than I can reasonably afford to put in.

So with “the number of events, their corresponding dice-rolls, and chat messages to the next event.” on your mind: How do you optimise a session-summary workflow for roleplay sessions on Discord? Discord Server hits 300k members! | Forum Promotion

Python discord bot – Code Review Stack Exchange


Your file reading is done in class static scope. It should be moved to class instance scope.

Type hints

Add some PEP484 type hints to your function signatures.

Type soundness and dictionary soup

Once you’ve read in your data from JSON, you should not leave it as dictionaries – make actual classes so that your data have stronger correctness guarantees and static analysis tools can actually say something about your code.

Another benefit of this approach is that your new classes for recipes and ingredients can have methods dealing with data specific to that class.


You haven’t built up any index dictionaries for faster, simpler lookup based on search terms; you should.

Line continuation

For long string, prefer to put them in parenthesized expressions rather than adding backslashes.

Bug: label

This statement:


does nothing, so you’ll never see your label.


garnisch -> garnish

Ingriedients -> Ingredients

Documentation lies

  """Returns all ingredients or cocktails containing the criteria in the parameter separated by commas."""

is not, in fact, what’s happening. Your split() splits on whitespace.


import json
from collections import defaultdict
from dataclasses import dataclass
from itertools import chain
from typing import Optional, Iterable, Tuple, Dict, Any, List

class FakeMessage:
    content: str

class Ingredient:
    name: str
    abv: float
    taste: Optional(str)

    def from_json(cls, fname: str = 'ingredients.json') -> Iterable('Ingredient'):
        with open(fname) as ingredients_file:
            data = json.load(ingredients_file)

        for name, attributes in data.items():
            yield cls(name=name, **attributes)

    def __str__(self):
        return f'{} ({self.abv}%)'

class RecipeIngredient:
    unit: str
    amount: float
    ingredient: Ingredient
    label: Optional(str) = None

    def from_dicts(
        dicts: Iterable(Dict(str, Any)),
        all_ingredients: Dict(str, Ingredient),
    ) -> Iterable('RecipeIngredient'):
        for data in dicts:
            if 'special' not in data:
                name = data.pop('ingredient')
                yield cls(**data, ingredient=all_ingredients(name.lower()))

    def __str__(self):
        desc = f'{self.amount} {self.unit} {self.ingredient}'
        if self.label is not None:
            desc += f' {self.label}'
        return desc

class Recipe:
    name: str
    glass: str
    category: str
    preparation: str
    ingredients: Tuple(RecipeIngredient, ...)
    special_ingredients: Tuple(str, ...)
    garnish: Optional(str) = None

    def from_json(
        all_ingredients: Dict(str, Ingredient),
        fname: str = 'recipes.json',
    ) -> Iterable('Recipe'):
        with open(fname) as recipes_file:
            data = json.load(recipes_file)

        for recipe in data:
            ingredient_data = recipe.pop('ingredients')
            specials = tuple(
                for ingredient in ingredient_data
                if 'special' in ingredient
            yield cls(
                    RecipeIngredient.from_dicts(ingredient_data, all_ingredients)

    def formatted_ingredients(self) -> str:
        """Returns a string of ingredients formatted as list for the cocktails including the special ones if it has
        ingredients = chain(self.ingredients, self.special_ingredients)
        return 'n'.join(
            f' - {ingredient}'
            for ingredient in ingredients

    def as_markdown(self) -> str:
        desc = (

        if self.garnish is not None:
            desc += f' - {self.garnish}n'

        desc += (
        return desc

class Bartender:
    ERROR = "There was a problem with processing the command"

    def __init__(self):
        self.ingredients: Dict(str, Ingredient) = {
   i for i in Ingredient.from_json()
        } Dict(str, Recipe) = {
   r for r in Recipe.from_json(self.ingredients)

        self.categories: Dict(str, List(Recipe)) = defaultdict(list)
        for recipe in

        self.by_ingredient: Dict(str, List(Recipe)) = defaultdict(list)
        for recipe in
            for ingredient in recipe.ingredients:

    def handle(self, message: FakeMessage) -> str:
        command_prefix = message.content.strip().lower()

        if self.starts_with_ingredients_prefix(command_prefix):
            return self.get_all_ingredients()
        if self.starts_with_cocktails_prefix(command_prefix):
            return self.get_all_cocktails()
        if command_prefix == "categories":
            return self.get_all_categories()
        if command_prefix.startswith("count"):
            return self.get_count(command_prefix.removeprefix("count").strip())
        if command_prefix.startswith("recipe"):
            return self.get_recipe(command_prefix.removeprefix("recipe").strip())
        if command_prefix.startswith("list"):
            return self.get_cocktails_by_category(command_prefix.removeprefix("list").strip())
        if command_prefix.startswith("find"):
            return self.find(command_prefix.removeprefix("find").strip())
        if command_prefix.startswith("with"):
            return self.get_cocktails_with(command_prefix.removeprefix("with").strip())

        return "This command does not exist or you mistyped something"

    def get_all_ingredients(self) -> str:
        """Returns a string containing all of the ingredients the bot knows."""
        return 'n'.join(str(i) for i in self.ingredients.values())

    def get_all_cocktails(self) -> str:
        """Returns a string containing the names of all of the cocktails the bot knows."""
        return 'n'.join( for r in

    def get_all_categories(self) -> str:
        """Returns a string containing all the cocktail categories the bot knows."""
        categories = sorted({
            for recipe in
        return 'n'.join(categories)

    def get_count(self, param: str) -> str:
        """Returns the amount of ingredients or cocktails the bot knows."""
        if self.starts_with_ingredients_prefix(param):
            sequence = self.ingredients
        elif self.starts_with_cocktails_prefix(param):
            sequence =
            return self.ERROR

        return str(len(sequence))

    def get_recipe(self, param: str) -> str:
        """Returns the full recipe for the passed cocktail name."""
        recipe =
        if recipe is None:
            return (
                f"There is no recipe for a cocktail called {param}. To see all "
                f"cocktails with a recipe type '$bt cocktails'"
        return recipe.as_markdown

    def get_cocktails_by_category(self, category: str) -> str:
        """Returns all cocktails in the given category."""
        recipes = self.categories.get(category)
        if not recipes:
            return f"There is no category called {category} or it contains no cocktails"

        return 'n'.join( for r in recipes)

    def starts_with_cocktails_prefix(param: str) -> bool:
        """Returns true if passed string starts with the cocktails prefix (-c or cocktails)."""
        return param.startswith("-c") or param.startswith("cocktails")

    def remove_cocktails_prefix(param: str) -> str:
        """Returns a string with the cocktails prefix (-c or cocktails) removed. If the string does not start with
        the cocktails prefix it will return the original string."""
        if param.startswith("-c"):
            return param.removeprefix("-c")
        if param.startswith("cocktails"):
            return param.removeprefix("cocktails")
        return param

    def starts_with_ingredients_prefix(param: str) -> bool:
        """Returns true if passed string starts with the ingredient prefix (-i or ingredients)."""
        return param.startswith("-i") or param.startswith("ingredients")

    def remove_ingredients_prefix(param: str) -> str:
        """Returns a string with the ingredient prefix (-i or ingredients) removed. If the string does not start with
        the ingredients prefix it will return the original string."""
        if param.startswith("-i"):
            return param.removeprefix("-i")
        if param.startswith("ingredients"):
            return param.removeprefix("ingredients")
        return param

    def find(self, param: str) -> str:
        """Returns all ingredients or cocktails containing the criteria in the parameter separated by commas."""
        answer = ""
        if self.starts_with_cocktails_prefix(param):
            param = self.remove_cocktails_prefix(param)
            for criteria in param.strip().split():
                answer += f"**Criteria: {criteria}**n"
                answer += self.get_cocktails_containing(criteria)
            return answer

        if self.starts_with_ingredients_prefix(param):
            param = self.remove_ingredients_prefix(param)
            for criteria in param.strip().split():
                answer += f"**Criteria: {criteria}**n"
                answer += self.get_ingredients_containing(criteria)
            return answer

        return self.ERROR

    def get_cocktails_containing(self, criteria: str) -> str:
        """Returns all cocktails containing the criteria in its name."""
        answer = ""
        for name, recipe in
            if criteria in name:
                answer += f"{}n"

        if answer:
            return answer
        return "Nothing was found matching your criteria"

    def get_ingredients_containing(self, criteria: str) -> str:
        """Returns all ingredients containing the criteria in its name."""
        answer = ""
        for name, ingredient in self.ingredients.items():
            if criteria in name:
                answer += f"{}n"

        if answer:
            return answer
        return "Nothing was found matching your criteria"

    def get_cocktails_with(self, param: str) -> str:
        """Returns all cocktails containing the searched for ingredients in the parameter separated by commas."""
        answer = 'n'.join(
            for ingredient in param.strip().split(",")
            for recipe in self.by_ingredient.get(ingredient, ())

        if answer:
            return answer
        return "Nothing was found matching your criteria"

def test():
    bar = Bartender()
    while True:
            cmd = input('> ')
        except KeyboardInterrupt:



How to simplify a discord bot in Python that updates and hosts a website for me by cloning from GitHub

After a bit of struggling I’ve come up with the code

import discord
import os
import subprocess as sub
import psutil

client = discord.Client()

my_path = os.getcwd()
program_instance = False
currently_installed = os.path.isdir("web-application")

def run_command(command):
    value = sub.Popen(command, stdout = sub.PIPE, stderr = sub.PIPE)
    return value.communicate()
def kill():
    global program_instance
    if not program_instance:
        return "Program instance not initiated";
    process = psutil.Process(
    for proc in process.children(recursive = True):
    program_instance = False
    return "Instance Killed"

def delete_if_exists():
    global currently_installed
    if currently_installed:
        os.system("rmdir /S /Q web-application")
        while currently_installed:
            currently_installed = os.path.isdir("web-application")

def download_from_git():
    #pull from git
    global currently_installed
    instance = sub.Popen("git clone LINKTOWEBAPPLICATION")
    currently_installed = True
    return "Successfully downloaded"
def run(download = False):
    global program_instance
    folders = run_command("dir")
    if not currently_installed or download:
    path = my_path+"\web-application"
    #installing values in pipenv
    install_command_instance = sub.Popen("pipenv install", cwd = path)
    program_instance = sub.Popen("pipenv run", cwd = path)
    return "App Running"

async def on_ready():
    print("Gitty woke")

async def on_message(message):
    if or not == MYDISCORDUSERID:
    command = message.content

    checker = lambda command_name: command == command_name

    if checker("run"):

    if checker("kill"):

    if checker("download"):

    if checker("run download"):
        await = True))

    if checker("ping"):
        currently_installed = os.path.isdir("web-application")
        await"Running:" + f"n{program_instance=}, {currently_installed=}")
with open(".key", "r") as key:

The biggest problem with this code was killing running processes. I just wanted to know if there are any easier ways to do this. And if I made any choices which are over complicated.

c# – Discord Bot Csharp JoinError

Im making a c# discord bot and the on user join won’t work, can anyone help? Thanks 🙂

private async Task AnnounceUserJoined(SocketGuildUser user)
            Console.WriteLine($"{user.Username} joined {user.Guild.Name}.");

The issue is when, i try to join my server it doesn’t write to the console that i joined. I don’t know what im doing wrong. And yes i have the thing where you need to do: _client.UserJoined += AnnouceUserJoined