mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 20:35:02 +00:00
Turn on strict TS compilation. Fix up and tweak types accordingly.
This commit is contained in:
parent
690955a399
commit
629002b8d9
172 changed files with 720 additions and 534 deletions
|
@ -30,7 +30,7 @@ export const RoleAddCmd = selfGrantableRolesCmd({
|
|||
const hasUnknownRoles = matchedRoleIds.length !== roleNames.length;
|
||||
|
||||
const rolesToAdd: Map<string, Role> = Array.from(matchedRoleIds.values())
|
||||
.map(id => pluginData.guild.roles.get(id))
|
||||
.map(id => pluginData.guild.roles.get(id)!)
|
||||
.filter(Boolean)
|
||||
.reduce((map, role) => {
|
||||
map.set(role.id, role);
|
||||
|
@ -68,9 +68,9 @@ export const RoleAddCmd = selfGrantableRolesCmd({
|
|||
rolesToAdd.delete(roleId);
|
||||
|
||||
if (msg.member.roles.includes(roleId)) {
|
||||
removed.add(pluginData.guild.roles.get(roleId));
|
||||
removed.add(pluginData.guild.roles.get(roleId)!);
|
||||
} else {
|
||||
skipped.add(pluginData.guild.roles.get(roleId));
|
||||
skipped.add(pluginData.guild.roles.get(roleId)!);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ export const RoleAddCmd = selfGrantableRolesCmd({
|
|||
const addedRolesStr = Array.from(rolesToAdd.values()).map(r => (mentionRoles ? `<@&${r.id}>` : `**${r.name}**`));
|
||||
const addedRolesWord = rolesToAdd.size === 1 ? "role" : "roles";
|
||||
|
||||
const messageParts = [];
|
||||
const messageParts: string[] = [];
|
||||
messageParts.push(`Granted you the ${addedRolesStr.join(", ")} ${addedRolesWord}`);
|
||||
|
||||
if (skipped.size || removed.size) {
|
||||
|
|
|
@ -10,7 +10,7 @@ export const RoleHelpCmd = selfGrantableRolesCmd({
|
|||
const applyingEntries = getApplyingEntries(pluginData, msg);
|
||||
if (applyingEntries.length === 0) return;
|
||||
|
||||
const allPrimaryAliases = [];
|
||||
const allPrimaryAliases: string[] = [];
|
||||
for (const entry of applyingEntries) {
|
||||
for (const aliases of Object.values(entry.roles)) {
|
||||
if (aliases[0]) {
|
||||
|
|
|
@ -26,7 +26,7 @@ export const RoleRemoveCmd = selfGrantableRolesCmd({
|
|||
const roleNames = normalizeRoleNames(splitRoleNames(args.roleNames));
|
||||
const matchedRoleIds = findMatchingRoles(roleNames, applyingEntries);
|
||||
|
||||
const rolesToRemove = Array.from(matchedRoleIds.values()).map(id => pluginData.guild.roles.get(id));
|
||||
const rolesToRemove = Array.from(matchedRoleIds.values()).map(id => pluginData.guild.roles.get(id)!);
|
||||
const roleIdsToRemove = rolesToRemove.map(r => r.id);
|
||||
|
||||
// Remove the roles
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue