Skip to content

Commit

Permalink
updated bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
LUISDASARTIMANHAS committed Jan 5, 2024
1 parent 17d7ad0 commit 8115f6a
Showing 1 changed file with 40 additions and 12 deletions.
52 changes: 40 additions & 12 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { config } from "dotenv";
import { REST } from "@discordjs/rest";
import { Client, GatewayIntentBits, Routes } from "discord.js";
import { Activity, ActivityType, Client, GatewayIntentBits, Routes } from "discord.js";
import pingCommand from "./commands/ping.js";
import helpCommand from "./commands/help.js";
import fs from "fs";
const rawData = fs.readFileSync("./data/config.json");
const configs = JSON.parse(rawData);
const date = new Date();
const ano = date.getFullYear();
const types = ["PLAYING", "WATCHING", "STREAMING", "LISTENING"];
config();
const token = process.env.TOKEN;
const CLIENT_ID = process.env.CLIENT_ID;
Expand All @@ -27,7 +26,7 @@ bot.on("ready", async () => {
const guildsCount = bot.guilds.cache.size;
const botTag = bot.user.tag;
const pingobrasLOG = await bot.channels.fetch("1032778034811506738");
const activities = [
const atividades = [
`${guildsCount} servidores!`,
configs.flag + configs.descricao + ano,
`${channelsCount} canais!`,
Expand All @@ -50,7 +49,7 @@ bot.on("ready", async () => {
let embedStatus = {
title: "**__🖥️MENSAGEM DO SERVIDOR PINGOBRAS🖥️:__**",
description: info,
color: 65280,
color: 16753920,
};
pingobrasLOG.send({ embeds: [embedStatus] });

Expand All @@ -59,15 +58,40 @@ bot.on("ready", async () => {
console.log("Servidores:" + guildsCount);

function alterarStatus() {
const ramdomActivity =
activities[Math.floor(Math.random() * activities.length)];
const ramdomType = types[Math.floor(Math.random() * types.length)];
const ramdomActivity = atividades[getRandomInt(atividades.length-1)];
const status = [
{
name: ramdomActivity,
type: ActivityType.Competing
},
{
name: "Website: pingobras.glitch.me",
type: ActivityType.Custom
},
{
name: ramdomActivity,
type: ActivityType.Listening
},
{
name: ramdomActivity,
type: ActivityType.Playing
},
{
name: ramdomActivity,
type: ActivityType.Streaming,
url: "https://pingobras.glitch.me"
},
{
name: ramdomActivity,
type: ActivityType.Watching
},
]
const ramdomStatus = status[getRandomInt(status.length-1)]

bot.user.setPresence({
activity: { type: ramdomType, name: ramdomActivity },
});
bot.user.setActivity(ramdomStatus);
bot.user.setStatus("idle");
console.log("STATUS DO DISCORD DO " + botTag);
console.log("Atividade do Status: " + ramdomType + ": " + ramdomActivity);
console.log(`Atividade do Status: ${ramdomActivity}`);
}
});

Expand Down Expand Up @@ -120,4 +144,8 @@ async function main() {
console.log(err);
}
}
main();
main();

function getRandomInt(max) {
return Math.floor(Math.random() * max);
}

0 comments on commit 8115f6a

Please sign in to comment.