Skip to content

Commit 14253d1

Browse files
committed
Added Guild Mute Commands
1 parent 880cb9b commit 14253d1

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

src/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@ import {
1111
sendSkyblockCoopMessage,
1212
sendGuildOfficerMessage,
1313
toggleGuildSlowChat,
14+
muteGuildChat,
15+
muteGuildMember,
16+
unmuteGuildChat,
17+
unmuteGuildMember,
1418
} from "./modules/index.js";
1519

16-
import type { Bot } from "../types/index.d.ts";
20+
import type { Bot, GuildMuteDurations } from "../types/index.d.ts";
1721
export type * from "../types/index.d.ts";
1822

1923
export const HyFlayer = (bot: Bot): void => {
@@ -32,6 +36,10 @@ export const HyFlayer = (bot: Bot): void => {
3236
bot.sendGuildMessage = (msg: string) => sendGuildMessage(bot, msg);
3337
bot.sendGuildOfficerMessage = (msg: string) => sendGuildOfficerMessage(bot, msg);
3438
bot.toggleGuildSlowChat = () => toggleGuildSlowChat(bot);
39+
bot.muteGuildChat = (duration: GuildMuteDurations) => muteGuildChat(bot, duration);
40+
bot.muteGuildMember = (member: string, duration: GuildMuteDurations) => muteGuildMember(bot, member, duration);
41+
bot.unmuteGuildChat = () => unmuteGuildChat(bot);
42+
bot.unmuteGuildMember = (member: string) => unmuteGuildMember(bot, member);
3543
bot.sendPrivateMessage = (player: string, msg: string) => sendPrivateMessage(bot, player, msg);
3644
bot.sendSkyblockCoopMessage = (msg: string) => sendSkyblockCoopMessage(bot, msg);
3745

src/modules/guild.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Bot } from "../../types/index.d.ts";
1+
import type { Bot, GuildMuteDurations } from "../../types/index.d.ts";
22

33
export const parseGuildChat = (bot: Bot) => {
44
bot.addChatPattern("hypixel_guild_chat", /^Guild > .*:.*/);
@@ -83,3 +83,19 @@ export const sendGuildOfficerMessage = (bot: Bot, msg: string) => {
8383
export const toggleGuildSlowChat = (bot: Bot) => {
8484
bot.chat(`/g slow`);
8585
};
86+
87+
export const muteGuildChat = (bot: Bot, duration: GuildMuteDurations) => {
88+
bot.chat(`/g mute everyone ${duration}`);
89+
};
90+
91+
export const muteGuildMember = (bot: Bot, player: string, duration: GuildMuteDurations) => {
92+
bot.chat(`/g mute ${player} ${duration}`);
93+
};
94+
95+
export const unmuteGuildChat = (bot: Bot) => {
96+
bot.chat(`/g unmute everyone`);
97+
};
98+
99+
export const unmuteGuildMember = (bot: Bot, player: string) => {
100+
bot.chat(`/g unmute ${player}`);
101+
};

types/index.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ export interface PlayerChatEvent extends PlayerEvent {
4949
message: string;
5050
}
5151

52+
export type GuildMuteDurations = "5m" | "15m" | "30m" | "1h" | "3h" | "6h" | "12h" | "1d" | "3d" | "5d" | "7d" | string;
53+
5254
/**
5355
* Extendes the basic Mineflayer Bot interface provided by the mineflayer library.
5456
*/
@@ -65,6 +67,10 @@ export interface Bot extends MineflayerBot {
6567
sendGuildMessage: (msg: string) => void;
6668
sendGuildOfficerMessage: (msg: string) => void;
6769
toggleGuildSlowChat: () => void;
70+
muteGuildChat: (duration: GuildMuteDurations) => void;
71+
muteGuildMember: (member: string, duration: GuildMuteDurations) => void;
72+
unmuteGuildChat: () => void;
73+
unmuteGuildMember: (member: string) => void;
6874
sendPrivateMessage: (player: string, msg: string) => void;
6975
sendSkyblockCoopMessage: (msg: string) => void;
7076
on<U extends keyof BotEvents>(event: U, listener: BotEvents[U]): this;

0 commit comments

Comments
 (0)