get rid of the remaining calls to BaseManager#resolve to make all cache access explicit
This commit is contained in:
parent
a21ed7a97f
commit
417bfc8a18
|
@ -145,7 +145,7 @@ export default new Command({
|
|||
description: "Displays info about mentioned user.",
|
||||
async run($: CommonLibrary): Promise<any> {
|
||||
// Transforms the User object into a GuildMember object of the current guild.
|
||||
const member = $.guild?.members.resolve($.args[0]) ?? (await $.guild?.members.fetch($.args[0]));
|
||||
const member = await $.guild?.members.fetch($.args[0]);
|
||||
|
||||
if (!member)
|
||||
return $.channel.send(
|
||||
|
|
|
@ -9,15 +9,14 @@ export default new Command({
|
|||
|
||||
if (!voiceChannel) return $.channel.send("You are not in a voice channel.");
|
||||
|
||||
if (!$.guild?.me?.hasPermission("MANAGE_CHANNELS"))
|
||||
if (!voiceChannel.guild.me?.hasPermission("MANAGE_CHANNELS"))
|
||||
return $.channel.send("I am lacking the required permissions to perform this action.");
|
||||
|
||||
if ($.args.length === 0) return $.channel.send("Please provide a new voice channel name.");
|
||||
|
||||
const changeVC = $.guild.channels.resolve(voiceChannel.id);
|
||||
$.channel
|
||||
.send(`Changed channel name from "${voiceChannel}" to "${$.args.join(" ")}".`)
|
||||
/// @ts-ignore
|
||||
.then(changeVC?.setName($.args.join(" ")));
|
||||
const prevName = voiceChannel.name;
|
||||
const newName = $.args.join(" ");
|
||||
await voiceChannel.setName(newName);
|
||||
await $.channel.send(`Changed channel name from "${prevName}" to "${newName}".`);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -172,7 +172,7 @@ export function formatUTCTimestamp(now = new Date()) {
|
|||
}
|
||||
|
||||
export function botHasPermission(guild: Guild | null, permission: number): boolean {
|
||||
return !!(client.user && guild?.members.resolve(client.user)?.hasPermission(permission));
|
||||
return !!(guild?.me?.hasPermission(permission));
|
||||
}
|
||||
|
||||
export function updateGlobalEmoteRegistry(): void {
|
||||
|
|
Loading…
Reference in New Issue