3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25:02 +00:00

Various bugfixes and change ct.anyId return to Snowflake

This commit is contained in:
Dark 2021-07-27 04:19:11 +02:00
parent c932269b7d
commit bc1330bf33
No known key found for this signature in database
GPG key ID: 384C4B4F5B1E25A8
7 changed files with 19 additions and 13 deletions

View file

@ -11,7 +11,7 @@ export const ReloadServerCmd = botControlCmd({
},
signature: {
guildId: ct.string(),
guildId: ct.anyId(),
},
async run({ pluginData, message: msg, args }) {

View file

@ -1,3 +1,4 @@
import { Snowflake } from "discord.js";
import { GlobalPluginData } from "knub";
import { SECONDS } from "../../../utils";
import { GuildConfigReloaderPluginType } from "../types";
@ -11,7 +12,7 @@ export async function reloadChangedGuilds(pluginData: GlobalPluginData<GuildConf
for (const item of changedConfigs) {
if (!item.key.startsWith("guild-")) continue;
const guildId = item.key.slice("guild-".length);
const guildId = item.key.slice("guild-".length) as Snowflake;
console.log(`Config changed, reloading guild ${guildId}`);
await pluginData.getKnubInstance().reloadGuild(guildId);

View file

@ -18,9 +18,10 @@ export const VoiceStateUpdateAlertEvt = locateUserEvt({
triggeredAlerts.forEach(alert => {
const txtChannel = meta.pluginData.guild.channels.resolve(alert.channel_id as Snowflake) as TextChannel;
txtChannel.send(
`🔴 <@!${alert.requestor_id}> the user <@!${alert.user_id}> disconnected out of \`<#!${voiceChannel.id}>\``,
);
txtChannel.send({
content: `🔴 <@!${alert.requestor_id}> the user <@!${alert.user_id}> disconnected out of \`${voiceChannel.name}\``,
allowedMentions: { users: [alert.requestor_id as Snowflake] },
});
});
}
},

View file

@ -4,7 +4,7 @@ export async function createOrReuseInvite(vc: VoiceChannel) {
const existingInvites = await vc.fetchInvites();
if (existingInvites.size !== 0) {
return existingInvites[0];
return existingInvites.first()!;
} else {
return vc.createInvite();
}

View file

@ -32,6 +32,10 @@ export const ButtonInteractionEvt = reactionRolesEvt({
};
if (context.stateless) {
if (context.roleOrMenu == null) {
// Not reaction from this plugin
return;
}
const timeSinceCreation = moment.utc().valueOf() - idToTimestamp(int.message.id)!;
if (timeSinceCreation >= BUTTON_INVALIDATION_TIME) {
sendEphemeralReply(

View file

@ -3,7 +3,7 @@ import { GuildPluginData } from "knub";
import { ReactionRolesPluginType } from "../types";
import { ButtonMenuActions } from "./buttonMenuActions";
export const BUTTON_CONTEXT_SEPARATOR = "::";
export const BUTTON_CONTEXT_SEPARATOR = ":rb:";
export async function getButtonAction(pluginData: GuildPluginData<ReactionRolesPluginType>, roleOrMenu: string) {
if (await pluginData.guild.roles.fetch(roleOrMenu as Snowflake).catch(() => false)) {