Skip to content
Draft
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
5 changes: 5 additions & 0 deletions MrMouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

from settings.config import TOKEN, PREFIX

import i18n

i18n.load_path.append("i18n/")
i18n.config.set('fallback', 'eng')

bot = Bot(command_prefix=PREFIX, fetch_offline_members=True)

extensions = [
Expand Down
146 changes: 89 additions & 57 deletions cogs/role.py

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions crowdin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
files:
- source: /i18n/*.eng.yml
translation: '/i18n/%file_name%%three_letters_code%.yml'
translation_replace:
'.eng': '.'
8 changes: 7 additions & 1 deletion events/on_error.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from discord import Forbidden
from discord.ext.commands import CheckFailure, NoPrivateMessage, CommandNotFound, BadArgument, Cog
from discord.ext.commands import CheckFailure, NoPrivateMessage, CommandNotFound, BadArgument, Cog, \
MissingRequiredArgument

from settings.lines import text_lines
from utils.utils import send_error_embed
Expand All @@ -13,6 +14,9 @@ def __init__(self, bot):
async def on_command_error(self, ctx, exception):
channel = ctx.channel

if hasattr(ctx.command, 'on_error'):
return

if isinstance(exception, NoPrivateMessage):
await send_error_embed(ctx, text_lines['technical']['cant_do_in_pm'])
elif isinstance(exception, BadArgument):
Expand All @@ -21,6 +25,8 @@ async def on_command_error(self, ctx, exception):
await send_error_embed(ctx, text_lines['roles']['ping']['no_access'])
elif isinstance(exception, CommandNotFound):
return
elif isinstance(exception, MissingRequiredArgument):
return
elif isinstance(exception, Forbidden):
await send_error_embed(ctx, text_lines['technical']['forbidden'].format(channel.name, ctx.guild), dm=True)
else:
Expand Down
9 changes: 9 additions & 0 deletions i18n/general.eng.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
eng:
commands:
on_cooldown: Sorry, this command is on cooldown!
roles_dont_exist:
one: Sorry, that role does not exist!
many: Sorry, one or more of those roles does not exist!
roles_not_provided: You must provide one or more roles for this command!
out_of_range: Number out of range
must_pass_number: You must pass a number to this command
46 changes: 46 additions & 0 deletions i18n/role.eng.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
eng:
list:
must_specify_type: "Which list are you looking for? You can select one of the following:"
body: "**%{role_type} roles**: %{role_list}"
assign:
added: The role **%{role}** has been added
removed: The role **%{role}** has been removed
keep: You already had **%{role}** and opted to keep it
already_have:
title: You already have this role
body: React with ✅ to remove it or react with ❌ if you don't want to do that. _Ignoring this message is also an option if you don't want to remove it_
not_allowed: You can't self-assign this role
dont_have: You don't have that role
native:
cant_remove: Did you add the wrong native tag? Add your actual native language first, then remove the incorrect tag using ;not
need_role: "**You need to tag your native language first**. Once you have a native tag, you can add learning and fluent tags."
search:
limit: You have to search at least 1 role, up to a maximum of %{max}
role_doesnt_exist: The role **%{role}** does not exist on the server.
no_users: No users were found
try_again: Please try again
users:
body:
one: 1 user matching %{role_list}
many: "%{count} users matching %{role_list}"
header:
one: The one and only
many: "%{start} - %{end}"
more: And %{count} more...
count:
users:
zero: No users match the combination %{role_list}
one: 1 user matches the combination %{role_list}
many: "%{count} users match the combination %{role_list}"
total: Total in %{role} - **%{count}**
ping:
not_allowed: Sorry, you cannot ping 1 or more of those roles!
missing_roles: Sorry, you need to provide at least one role to ping!
body: PING! %{author} is pinging %{role_list}
top10:
native: Native
fluent: Fluent
learning: Learning
footer: Out of %{role_count} roles and %{member_count} members
less:
title: Roles with fewer than %{count} members
86 changes: 86 additions & 0 deletions settings/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,89 @@

GITHUB_LINK = 'https://github.com/Linglot/mouse'
INVITE_LINK = 'https://discord.gg/uFWNUBQ'

LANGUAGE_CODES = {
'Afrikaans': 'afr',
'Albanian': 'sqi',
'Arabic': 'ara',
'Armenian': 'hye',
'Azerbaijani': 'aze',
'Belarusian': 'bel',
'Bengali': 'bn',
'Berber': 'ber',
'Bisaya': 'ceb',
'Bosnian': 'bos',
'Bulgarian': 'bul',
'Burmese': 'mya',
'Cantonese': 'yue',
'Cherokee': 'chr',
'Croatian': 'hrv',
'Czech': 'ces',
'Danish': 'dan',
'Dutch': 'nld',
'English': 'eng',
'Estonian': 'est',
'Faroese': 'fao',
'Finnish': 'fin',
'French': 'fra',
'Fula': 'ful',
'Georgian': 'kat',
'German': 'deu',
'Greek': 'ell',
'Greenlandic': 'kal',
'Gujatari': 'guj',
'Hakka': 'hak',
'Hebrew': 'heb',
'Hindi': 'hin',
'Hungarian': 'hun',
'Icelandic': 'isl',
'Indonesian': 'ind',
'Irish': 'gle',
'Italian': 'ita',
'Japanese': 'jpn',
'Kannada': 'kan',
'Kazakh': 'kaz',
'Khmer': 'khm',
'Korean': 'kor',
'Kurdish': 'kur',
'Kyrgyz': 'kir',
'Latvian': 'lav',
'Lithuanian': 'lit',
'Luxembourgish': 'ltz',
'Macedonian': 'mkd',
'Malagasy': 'mlg',
'Malayalam': 'mal',
'Malaysian': 'msa',
'Mandarin': 'cmn',
'Marathi': 'mar',
'Mongolian': 'mon',
'Montenegrin': 'cnr',
'Nepali': 'nep',
'Norwegian': 'nor',
'Pashto': 'pus',
'Persian': 'fas',
'Polish': 'pol',
'Portuguese': 'por',
'Punjabi': 'pan',
'Romanian': 'ron',
'Russian': 'rus',
'Serbian': 'srp',
'Sinhalese': 'sin',
'Slovak': 'slk',
'Slovene': 'slv',
'Spanish': 'spa',
'Swahili': 'swa',
'Swedish': 'swe',
'Tagalog': 'tgl',
'Tamil': 'tam',
'Tatar': 'tat',
'Telugu': 'tel',
'Thai': 'tha',
'Turkish': 'tur',
'Ukrainian': 'ukr',
'Urdu': 'urd',
'Uzbek': 'uzb',
'Vietnamese': 'vie',
'Welsh': 'cym',
'Wolof': 'wol'
}