Skip to content

Commit

Permalink
fix hi
Browse files Browse the repository at this point in the history
  • Loading branch information
lajbel committed Dec 3, 2021
1 parent d1ad16d commit 58b8614
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
9 changes: 5 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 } from "../deps/discordeno.ts";
import { ApplicationCommandOptionTypes, Bot, DiscordenoInteraction, InteractionResponseTypes, sendInteractionResponse, getUser, } from "../deps/discordeno.ts";

export default () => {
return {
Expand All @@ -12,12 +12,13 @@ export default () => {
required: false,
},
],
exe: (bot: Bot, interaction: DiscordenoInteraction) => {
const member = interaction?.data?.resolved?.members?.first() || interaction?.member
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}` },
data: { content: `Oh hi ${member?.nick ?? user?.username }` },
});
},
};
Expand Down
4 changes: 2 additions & 2 deletions src/deps/discordeno.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export {
sendInteractionResponse,
sendMessage,
startBot,
} from "https://deno.land/x/discordeno@13.0.0-rc6/mod.ts";
} from "https://deno.land/x/discordeno@13.0.0-rc11/mod.ts";

export type {
Bot,
Expand All @@ -27,4 +27,4 @@ export type {
DiscordenoMember,
DiscordenoMessage,
GuildMember,
} from "https://deno.land/x/discordeno@13.0.0-rc6/mod.ts";
} from "https://deno.land/x/discordeno@13.0.0-rc11/mod.ts";
5 changes: 1 addition & 4 deletions src/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,13 @@ const bot: Bot = createBot({
token: token,
botId: BigInt(id),
applicationId: BigInt(id),
intents: ["Guilds", "GuildMessages"],
events: {
interactionCreate,
messageCreate,
messageDelete,
ready,
},
intents: ["Guilds", "GuildMessages"],
cache: {
isAsync: false,
},
});

// load interactions (commands and buttons)
Expand Down

0 comments on commit 58b8614

Please sign in to comment.