Skip to content

Commit

Permalink
tip command and format
Browse files Browse the repository at this point in the history
  • Loading branch information
lajbel committed Dec 4, 2021
1 parent 58b8614 commit 325b219
Show file tree
Hide file tree
Showing 13 changed files with 74 additions and 66 deletions.
5 changes: 3 additions & 2 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
"fmt": {
"files": {
"exclude": [
"velociraptor.yaml"
"velociraptor.yaml",
"src/deps/"
]
},
"options": {
"useTabs": true,
"lineWidth": 400,
"lineWidth": 160,
"indentWidth": 4,
"singleQuote": false,
"proseWrap": "preserve"
Expand Down
2 changes: 1 addition & 1 deletion src/buttons/announcements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ export default () => {
}
},
};
}
};
2 changes: 1 addition & 1 deletion src/buttons/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ export default () => {
}
},
};
}
};
2 changes: 1 addition & 1 deletion src/commands/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ export default () => {
});
},
};
}
};
8 changes: 4 additions & 4 deletions src/commands/hi.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ApplicationCommandOptionTypes, Bot, DiscordenoInteraction, InteractionResponseTypes, sendInteractionResponse, getUser, } from "../deps/discordeno.ts";
import { ApplicationCommandOptionTypes, Bot, DiscordenoInteraction, getUser, InteractionResponseTypes, sendInteractionResponse } from "../deps/discordeno.ts";

export default () => {
return {
Expand All @@ -15,11 +15,11 @@ export default () => {
exe: async (bot: Bot, interaction: DiscordenoInteraction) => {
const member = interaction?.data?.resolved?.members?.first() || interaction?.member;
const user = await getUser(bot, member?.id!);

sendInteractionResponse(bot, interaction.id, interaction.token, {
type: InteractionResponseTypes.ChannelMessageWithSource,
data: { content: `Oh hi ${member?.nick ?? user?.username }` },
data: { content: `Oh hi ${member?.nick ?? user?.username}` },
});
},
};
}
};
9 changes: 7 additions & 2 deletions src/commands/kaboom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ export default () => {
description: "KaBoom!!!",
options: [],
exe: (bot: Bot, interaction: DiscordenoInteraction) => {
const funnyKaboom = ["https://imgur.com/EFhRwqF.gif", "https://imgur.com/dZyIaSR.gif", "https://imgur.com/aYobVCy.gif", "https://imgur.com/BI875Rq.gif"];
const funnyKaboom = [
"https://imgur.com/EFhRwqF.gif",
"https://imgur.com/dZyIaSR.gif",
"https://imgur.com/aYobVCy.gif",
"https://imgur.com/BI875Rq.gif",
];

const response = funnyKaboom[Math.floor(Math.random() * funnyKaboom.length)];

Expand All @@ -16,4 +21,4 @@ export default () => {
});
},
};
}
};
5 changes: 3 additions & 2 deletions src/commands/roles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export default () => {
const embed = {
color: 0xffe359,
title: "Roles of Kaboom Discord",
description: "<@&901298683906240582> - <:minimark:883793329647652934> - You will be mentioned by people who need help\n<@&901533627802873876> - <:cowmark:884789264745897994> - You will be mentioned for announcements",
description:
"<@&901298683906240582> - <:minimark:883793329647652934> - You will be mentioned by people who need help\n<@&901533627802873876> - <:cowmark:884789264745897994> - You will be mentioned for announcements",
};

sendInteractionResponse(bot, interaction.id, interaction.token, {
Expand Down Expand Up @@ -42,4 +43,4 @@ export default () => {
});
},
};
}
};
29 changes: 29 additions & 0 deletions src/commands/tip.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { sendInteractionResponse, Bot, DiscordenoInteraction, Embed, InteractionResponseTypes, } from "../deps/discordeno.ts";

export default () => {
return {
name: "tip",
description: "Get a tip of the Kaboom World",
options: [],
exe: (bot: Bot, interaction: DiscordenoInteraction) => {
const tips = [
{ t: "npm i kaboom@next", img: null },
];

const tip = tips[Math.floor(Math.random() * tips.length)];

const embed: Embed = {
color: 0xffe359,
title: "TIP",
description: tip.t,
};

if(tip.img) embed.image = { url: tip.img };

sendInteractionResponse(bot, interaction.id, interaction.token, {
type: InteractionResponseTypes.ChannelMessageWithSource,
data: { embeds: [ embed ] },
});
},
};
}
29 changes: 15 additions & 14 deletions src/deps/discordeno.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
export {
addRole,
ApplicationCommandOptionTypes,
ApplicationCommandTypes,
ButtonStyles,
channelOverwriteHasPermission,
createBot,
createApplicationCommand,
createBot,
deleteMessage,
ActivityTypes,
InteractionResponseTypes,
MessageComponentTypes,
OverwriteTypes,
editBotStatus,
getMember,
getUser,
removeRole,
sendInteractionResponse,
sendMessage,
startBot,
ActivityTypes,
ApplicationCommandOptionTypes,
ApplicationCommandTypes,
ButtonStyles,
InteractionResponseTypes,
MessageComponentTypes,
OverwriteTypes,
} from "https://deno.land/x/discordeno@13.0.0-rc11/mod.ts";

export type {
Bot,
CreateGlobalApplicationCommand,
DiscordenoInteraction,
DiscordenoMember,
DiscordenoMessage,
GuildMember,
Bot,
CreateGlobalApplicationCommand,
DiscordenoInteraction,
DiscordenoMember,
DiscordenoMessage,
Embed,
GuildMember
} from "https://deno.land/x/discordeno@13.0.0-rc11/mod.ts";
2 changes: 1 addition & 1 deletion src/deps/dotenv.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { config } from "https://deno.land/x/dotenv/mod.ts";

export type { DotenvConfig } from "https://deno.land/x/dotenv/mod.ts";
export type { DotenvConfig } from "https://deno.land/x/dotenv/mod.ts";
29 changes: 0 additions & 29 deletions src/events/messageDelete.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/events/ready.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { editBotStatus, getUser, Bot, ActivityTypes, } from "../deps/discordeno.ts";
import { ActivityTypes, Bot, editBotStatus, getUser } from "../deps/discordeno.ts";

export async function ready(bot: Bot) {
const botUser = await getUser(bot, bot.id);
Expand Down
16 changes: 8 additions & 8 deletions src/mod.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { createBot, createApplicationCommand, startBot, Bot, ApplicationCommandTypes, } from "./deps/discordeno.ts";
import { config, DotenvConfig, } from "./deps/dotenv.ts";
import { ApplicationCommandTypes, Bot, createApplicationCommand, createBot, startBot } from "./deps/discordeno.ts";
import { config, DotenvConfig } from "./deps/dotenv.ts";

import { readDir, } from "./util/readDir.ts";
import { readDir } from "./util/readDir.ts";

import { interactionCreate, } from "./events/interactionCreate.ts";
import { messageCreate, } from "./events/messageCreate.ts";
import { messageDelete, } from "./events/messageDelete.ts";
import { ready, } from "./events/ready.ts";
import { interactionCreate } from "./events/interactionCreate.ts";
import { messageCreate } from "./events/messageCreate.ts";
import { messageDelete } from "./events/messageDelete.ts";
import { ready } from "./events/ready.ts";

const env: DotenvConfig = config();

Expand Down Expand Up @@ -49,7 +49,7 @@ readDir("src/commands", async (file) => {
});

readDir("src/buttons", async (file) => {
const btn = await import(`./buttons/${file.name}`);
const btn = await import(`./buttons/${file.name}`);
const button = btn.default();

buttonsActions.set(button.name, button);
Expand Down

2 comments on commit 325b219

@deno-deploy
Copy link

@deno-deploy deno-deploy bot commented on 325b219 Dec 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failed to deploy:

failed to fetch 'https://raw.githubusercontent.com/lajbel/markbot/325b21916e67e21372f27557244550ced90083d1/src/events/messageDelete.ts': HTTP status client error (404 Not Found) for url (https://raw.githubusercontent.com/lajbel/markbot/325b21916e67e21372f27557244550ced90083d1/src/events/messageDelete.ts)

@deno-deploy
Copy link

@deno-deploy deno-deploy bot commented on 325b219 Dec 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failed to deploy:

failed to fetch 'https://raw.githubusercontent.com/lajbel/markbot/325b21916e67e21372f27557244550ced90083d1/src/events/messageDelete.ts': HTTP status client error (404 Not Found) for url (https://raw.githubusercontent.com/lajbel/markbot/325b21916e67e21372f27557244550ced90083d1/src/events/messageDelete.ts)

Please sign in to comment.