Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: voicekick command #225

Merged
merged 3 commits into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ en:
botrepo: "Posts the URL of the bot's Git repo"
avatar: "Posts the URL of a user's avatar"
invite: 'Sends a link to invite the bot to your server'
voicekick: 'Move a user to the AFK channel or given channel'

archwiki: 'Searches the Arch wiki'
packagesearch: 'Searches for a package in the Arch repositories'
Expand Down Expand Up @@ -198,6 +199,9 @@ en:
invite:
title: "Invite %s"
desc: "[Click this link to invite %s to your server.](%s)"
voicekick:
failure: "No AFK channel in server and no channel given"
success: "Moved user to channel"

xkcd:

Expand Down
4 changes: 4 additions & 0 deletions lib/locales/en_kawaii.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ en_kawaii:
botrepo: "Look inside my source code, please tell me if there are any bugs, I hate bugs (◕﹏◕)"
avatar: "Do I look good in this picture?"
invite: "Get an invite link to add me to your server~!"
voicekick: "I'll move a user to another voice channel for you~!"

slowmode: "You wouldn't... would you? (◕﹏◕)"

Expand Down Expand Up @@ -215,6 +216,9 @@ en_kawaii:
invite:
title: "Invite %s to your server! (^◡^)"
desc: "[Click this link to invite %s to your server](%s) so we can be together even more (^◡^)"
voicekick:
failure: "I couldn't find an AFK channel, and you didn't give one (ó﹏ò。)"
success: "I scooted them to the new channel! (^◡^)"

uc:
help:
Expand Down
4 changes: 4 additions & 0 deletions lib/locales/tok.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ tok:
botrepo: 'ilo li pana e lupa tawa tomo pali ilo'
avatar: 'ilo li pana e lupa pi sitelen sinpin jan'
invite: 'sina ken pana e ilo tawa kulupu ante'
voicekick: 'sina tawa e jan tawa tomo kalama ante'

archwiki: 'sina ken alasa e lipu sona lon tomo sona pi nasin ilo Asu'
packagesearch: 'sina ken alasa e poki pali lon nasin ilo Asu'
Expand Down Expand Up @@ -198,6 +199,9 @@ tok:
invite:
title: 'o kama e %s'
desc: '[linja ni la sina ken kama e %s tawa kulupu sina.](%s)'
voicekick:
failure: 'tomo awen li lon ala. sina pana ala e tomo.'
success: "ona li lon tomo"

xkcd:

Expand Down
22 changes: 22 additions & 0 deletions modules/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,26 @@ def self.full_avatar(user)
event.respond event.channel.slowmode_rate
end
end

command :voicekick, {
help_available: true,
usage: '.voicekick [user] [channel]',
min_args: 1,
max_args: 2
} do |event, user, channel|
unless event.author.permission?(:move_members, event.channel)
event.respond t('no_perms')
return
end

target_channel = channel || event.server.afk_channel
unless target_channel
event.respond t('util.voicekick.failure')
return
end

target_user = cmd_target(event, user)
event.server.move(target_user, target_channel)
event.respond t('util.voicekick.success')
end
end