Skip to content

Commit

Permalink
Dev src
Browse files Browse the repository at this point in the history
  • Loading branch information
Blocksnmore committed Jun 30, 2021
1 parent 5476a9d commit f41e8a2
Show file tree
Hide file tree
Showing 62 changed files with 1,451 additions and 2,068 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.env
temp/
run.bat
4 changes: 2 additions & 2 deletions .replit
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
language = "nodejs"
run = "node ."
language = "deno"
run = "deno run --import-map=imports.json --allow-net --allow-env --allow-read index.ts"
10 changes: 10 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"deno.enable": true,
"deno.lint": true,
"deno.unstable": true,
"deno.importMap": "./imports.json",
"deno.config": "./tsconfig.json",
"deno.suggest.imports.hosts": {
"https://deno.land": true
}
}
13 changes: 2 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,2 @@
# BIDOME
BIDOME BOT - Report bugs or suggest a feature here.
---
Use the issue tab to report bugs or suggest features
To contribute to the bot:

| Command | Directory |
| --- | --- |
| Statuses | Status.js |
| MhMeme | Assets/memes/mhmemes.txt |

# Bidome Bot
Info coming soon!
10 changes: 0 additions & 10 deletions Template.js

This file was deleted.

38 changes: 38 additions & 0 deletions assets/fun.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"eightball": {
"responses": [
"It is Certain.",
"It is decidedly so.",
"Without a doubt.",
"Yes definitely.",
"You may rely on it.",
"As I see it, yes.",
"Most likely.",
"Outlook good.",
"Yes.",
"Signs point to yes.",
"Reply hazy, try again.",
"Ask again later.",
"Better not tell you now.",
"Cannot predict now.",
"Concentrate and ask again.",
"Don't count on it.",
"My reply is no.",
"My sources say no.",
"Outlook not so good.",
"Very doubtful."
]
},
"dice": {
"firstrow": [
4,
6,
8,
10,
12
],
"secondrow": [
20
]
}
}
2 changes: 0 additions & 2 deletions assets/home.html

This file was deleted.

Binary file added assets/lavalink.jar
Binary file not shown.
5 changes: 0 additions & 5 deletions assets/memes/mhmemes.txt

This file was deleted.

Binary file removed assets/pvideos/vid1.mp4
Binary file not shown.
Binary file removed assets/pvideos/vid2.mp4
Binary file not shown.
Binary file removed assets/pvideos/vid3.mp4
Binary file not shown.
Binary file removed assets/pvideos/vid4.mp4
Binary file not shown.
7 changes: 0 additions & 7 deletions assets/styles.css

This file was deleted.

65 changes: 0 additions & 65 deletions commands/admin/config.js

This file was deleted.

23 changes: 0 additions & 23 deletions commands/dev/eval.js

This file was deleted.

60 changes: 60 additions & 0 deletions commands/dev/eval.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { Command, CommandContext, Embed } from 'harmony';

export class command extends Command {
name = 'eval';
ownerOnly = true;
category = 'dev';
aliases = ['execute'];
description = 'Execute code';
usage = 'Eval <code>';
async execute(ctx: CommandContext) {
let code = ctx.argString ?? '';
if (code.startsWith("```ts") || code.startsWith(" ```ts")) {
code = code.substring(code.split("\n")[0].length, code.length - 3);
}
const message = await ctx.message.reply(undefined, {
embed: new Embed({
author: {
name: 'Bidome bot',
icon_url: ctx.message.client.user?.avatarURL(),
},
description: 'Executing code!',
}).setColor('random'),
});
try {
const executed = await eval(code);
console.log(
'Output from command ' + code + ', ',
executed ?? 'No output!'
);
await message.edit(
new Embed({
author: {
name: 'Bidome bot',
icon_url: ctx.message.client.user?.avatarURL(),
},
title: 'Executed code',
description: 'Please check console for an output!',
}).setColor('random')
);
} catch (e: unknown) {
console.log(
'An error occured while executing the eval command ' +
code +
'! Error: ',
e
);
await message.edit(
new Embed({
author: {
name: 'Bidome bot',
icon_url: ctx.message.client.user?.avatarURL(),
},
title: 'Error occured while executing!',
description: 'Please check console for an error!',
}).setColor('random')
);
return;
}
}
}
88 changes: 88 additions & 0 deletions commands/dev/presence.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import {
Command,
CommandContext,
Embed,
isMessageComponentInteraction,
} from 'harmony';
import { format } from 'tools';

export class command extends Command {
name = 'setpresence';
ownerOnly = true;
category = 'dev';
description = "Change the bot's presence";
usage = 'Setpresence';
async execute(ctx: CommandContext) {
const now = Date.now();
const message = await ctx.message.reply(undefined, {
embed: new Embed({
author: {
name: 'Bidome bot',
icon_url: ctx.message.client.user?.avatarURL(),
},
title: 'Bot status',
description: 'Please select the status type!',
footer: {
text: 'This will time out in 30 seconds!',
},
}).setColor('random'),
components: [
{
type: 1,
components: ['dnd', 'idle', 'online', 'invisible'].map(
(status) => ({
type: 2,
label: format(status),
style: 'BLURPLE',
customID: `${status.toLowerCase()}-${now}`,
})
),
},
],
});

const choice = await ctx.client.waitFor(
'interactionCreate',
(i) =>
isMessageComponentInteraction(i) &&
i.customID.endsWith(`-${now}`) &&
i.user.id === ctx.author.id,
30 * 1000
);
if (!choice[0]) {
await message.edit(undefined, {
embed: new Embed({
author: {
name: 'Bidome bot',
icon_url: ctx.message.client.user?.avatarURL(),
},
title: 'Bot status',
description: 'Presence change timed out!',
}).setColor('random'),
components: [],
});
return;
} else {
if (!isMessageComponentInteraction(choice[0])) return;
const type = choice[0].customID.split('-')[0].toUpperCase() as
| 'dnd'
| 'idle'
| 'online'
| 'invisible';
ctx.client.setPresence({
status: type,
});
await message.edit(undefined, {
embed: new Embed({
author: {
name: 'Bidome bot',
icon_url: ctx.message.client.user?.avatarURL(),
},
title: 'Bot status',
description: 'Presence has been changed!',
}).setColor('random'),
components: [],
});
}
}
}
Loading

0 comments on commit f41e8a2

Please sign in to comment.