3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-12 04:55:01 +00:00

Add custom logger. Fix a bunch of errors. Optimize imports.

This commit is contained in:
Dragory 2020-07-22 22:56:21 +03:00
parent 0dae54745d
commit 1064a1ca46
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
89 changed files with 198 additions and 229 deletions

View file

@ -9,7 +9,7 @@ export async function moveMember(
target: Member,
errorChannel: TextableChannel,
) {
const modMember: Member = await this.bot.getRESTGuildMember(pluginData.guild.id, toMoveID);
const modMember: Member = await pluginData.client.getRESTGuildMember(pluginData.guild.id, toMoveID);
if (modMember.voiceState.channelID != null) {
try {
await modMember.edit({

View file

@ -12,6 +12,6 @@ export async function outdatedAlertsLoop(pluginData) {
}
if (!pluginData.state.unloaded) {
pluginData.state.outdatedAlertsTimeout = setTimeout(() => this.outdatedAlertsLoop(pluginData), ALERT_LOOP_TIME);
pluginData.state.outdatedAlertsTimeout = setTimeout(() => outdatedAlertsLoop(pluginData), ALERT_LOOP_TIME);
}
}

View file

@ -12,7 +12,7 @@ export async function sendAlerts(pluginData: PluginData<LocateUserPluginType>, u
triggeredAlerts.forEach(alert => {
const prepend = `<@!${alert.requestor_id}>, an alert requested by you has triggered!\nReminder: \`${alert.body}\`\n`;
const txtChannel = pluginData.client.getChannel(alert.channel_id) as TextableChannel;
sendWhere.call(this, pluginData.guild, member, txtChannel, prepend);
sendWhere(pluginData, member, txtChannel, prepend);
if (alert.active) {
moveMember(pluginData, alert.requestor_id, member, txtChannel);
}

View file

@ -1,9 +1,17 @@
import { Guild, Member, TextableChannel, VoiceChannel } from "eris";
import { Member, TextableChannel, VoiceChannel } from "eris";
import { getInviteLink } from "knub/dist/helpers";
import { createOrReuseInvite } from "./createOrReuseInvite";
import { PluginData } from "knub";
import { LocateUserPluginType } from "../types";
import { sendErrorMessage } from "../../../pluginUtils";
export async function sendWhere(guild: Guild, member: Member, channel: TextableChannel, prepend: string) {
const voice = guild.channels.get(member.voiceState.channelID) as VoiceChannel;
export async function sendWhere(
pluginData: PluginData<LocateUserPluginType>,
member: Member,
channel: TextableChannel,
prepend: string,
) {
const voice = pluginData.guild.channels.get(member.voiceState.channelID) as VoiceChannel;
if (voice == null) {
channel.createMessage(prepend + "That user is not in a channel");
@ -12,7 +20,7 @@ export async function sendWhere(guild: Guild, member: Member, channel: TextableC
try {
invite = await createOrReuseInvite(voice);
} catch (e) {
this.sendErrorMessage(channel, "Cannot create an invite to that channel!");
sendErrorMessage(pluginData, channel, "Cannot create an invite to that channel!");
return;
}
channel.createMessage(