Compare commits
4 commits
b9b53ef3e8
...
fbb9064434
Author | SHA1 | Date | |
---|---|---|---|
fbb9064434 | |||
e77f85edc6 | |||
0a57edfcb3 | |||
73db4e59c2 |
6 changed files with 280 additions and 249 deletions
src/EllieBot
Modules
strings
|
@ -51,12 +51,9 @@ public sealed class HangmanService : IHangmanService, IExecNoCommand
|
|||
}
|
||||
|
||||
public ValueTask<bool> StopHangman(ulong channelId)
|
||||
{
|
||||
lock (_locker)
|
||||
{
|
||||
if (_hangmanGames.TryRemove(channelId, out _))
|
||||
return new(true);
|
||||
}
|
||||
|
||||
return new(false);
|
||||
}
|
||||
|
@ -66,8 +63,11 @@ public sealed class HangmanService : IHangmanService, IExecNoCommand
|
|||
|
||||
public async Task ExecOnNoCommandAsync(IGuild guild, IUserMessage msg)
|
||||
{
|
||||
if (_hangmanGames.ContainsKey(msg.Channel.Id))
|
||||
if (!_hangmanGames.ContainsKey(msg.Channel.Id))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(msg.Content))
|
||||
return;
|
||||
|
||||
|
@ -108,7 +108,6 @@ public sealed class HangmanService : IHangmanService, IExecNoCommand
|
|||
|
||||
await SendState((ITextChannel)msg.Channel, msg.Author, msg.Content, state);
|
||||
}
|
||||
}
|
||||
|
||||
private Task<IUserMessage> SendState(
|
||||
ITextChannel channel,
|
||||
|
|
|
@ -322,17 +322,29 @@ public sealed partial class Help : EllieModule<HelpService>
|
|||
var transformed = g
|
||||
.Select(x =>
|
||||
{
|
||||
var prepend = string.Empty;
|
||||
|
||||
var isOwnerOnly = x.Preconditions.Any(x => x is OwnerOnlyAttribute);
|
||||
if (isOwnerOnly)
|
||||
prepend = " \\👑";
|
||||
|
||||
//if cross is specified, and the command doesn't satisfy the requirements, cross it out
|
||||
if (opts.View == CommandsOptions.ViewType.Cross)
|
||||
{
|
||||
return $"{(succ.Contains(x) ? "✅" : "❌")} {prefix + x.Aliases[0]}";
|
||||
var outp = $"{(succ.Contains(x) ? "✅" : "❌")} {prefix + x.Aliases[0]}";
|
||||
|
||||
return prepend + outp;
|
||||
}
|
||||
|
||||
var output = prefix + x.Aliases[0];
|
||||
|
||||
if (x.Aliases.Count == 1)
|
||||
return prefix + x.Aliases[0];
|
||||
if (x.Aliases.Count > 1)
|
||||
output += " | " + prefix + x.Aliases[1];
|
||||
|
||||
return prefix + x.Aliases[0] + " | " + prefix + x.Aliases[1];
|
||||
if (opts.View == CommandsOptions.ViewType.All)
|
||||
return prepend + output;
|
||||
|
||||
return output;
|
||||
});
|
||||
|
||||
embed.AddField(g.Key, "" + string.Join("\n", transformed) + "", true);
|
||||
|
@ -347,7 +359,9 @@ public sealed partial class Help : EllieModule<HelpService>
|
|||
{
|
||||
var groupName = smc.Data.Values.FirstOrDefault();
|
||||
var mdl = _cmds.Modules.FirstOrDefault(x
|
||||
=> string.Equals(x.Name.Replace("Commands", ""), groupName, StringComparison.InvariantCultureIgnoreCase));
|
||||
=> string.Equals(x.Name.Replace("Commands", ""),
|
||||
groupName,
|
||||
StringComparison.InvariantCultureIgnoreCase));
|
||||
await smc.DeferAsync();
|
||||
await Group(mdl);
|
||||
}
|
||||
|
|
|
@ -201,12 +201,17 @@ public partial class Utility
|
|||
message,
|
||||
ReminderType.User);
|
||||
|
||||
var eb = CreateEmbed()
|
||||
.WithOkColor()
|
||||
.WithAuthor(ctx.User)
|
||||
.WithTitle(GetText(strs.reminder_created))
|
||||
.AddField(GetText(strs.who_where), !isPrivate ? $"<#{targetId}>" : ctx.User.Username, true)
|
||||
.AddField(GetText(strs.when), TimestampTag.FromDateTime(time, TimestampTagStyles.Relative), true)
|
||||
.AddField(GetText(strs.date2), TimestampTag.FromDateTime(time, TimestampTagStyles.ShortDateTime), true)
|
||||
.WithDescription(message);
|
||||
|
||||
await Response()
|
||||
.Confirm($"\u23f0 {GetText(strs.remind2(
|
||||
Format.Bold(!isPrivate ? $"<#{targetId}>" : ctx.User.Username),
|
||||
Format.Bold(message),
|
||||
TimestampTag.FromDateTime(DateTime.UtcNow.Add(ts), TimestampTagStyles.Relative),
|
||||
TimestampTag.FormatFromDateTime(time, TimestampTagStyles.ShortDateTime)))}")
|
||||
.Embed(eb)
|
||||
.SendAsync();
|
||||
|
||||
return true;
|
||||
|
|
|
@ -112,12 +112,13 @@ public partial class Utility : EllieModule
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
var userNames = new List<IUser>(socketGuild.Users.Count / 100);
|
||||
foreach (var user in socketGuild.Users)
|
||||
{
|
||||
if (user.Activities.Any(x => x.Name is not null && x.Name.ToUpperInvariant() == game))
|
||||
var activity = user.Activities.FirstOrDefault(x => x.Name is not null && x.Name.ToUpperInvariant() == game);
|
||||
if (activity is not null)
|
||||
{
|
||||
game = activity.Name;
|
||||
userNames.Add(user);
|
||||
}
|
||||
}
|
||||
|
@ -129,6 +130,9 @@ public partial class Utility : EllieModule
|
|||
.PageSize(20)
|
||||
.Page((names, _) =>
|
||||
{
|
||||
var eb = CreateEmbed()
|
||||
.WithTitle(GetText(strs.whos_playing_game(userNames.Count, game)));
|
||||
|
||||
if (names.Count == 0)
|
||||
{
|
||||
return CreateEmbed()
|
||||
|
@ -136,8 +140,7 @@ public partial class Utility : EllieModule
|
|||
.WithDescription(GetText(strs.nobody_playing_game));
|
||||
}
|
||||
|
||||
var eb = CreateEmbed()
|
||||
.WithOkColor();
|
||||
eb = eb.WithOkColor();
|
||||
|
||||
var users = names.Join('\n');
|
||||
|
||||
|
@ -646,7 +649,7 @@ public partial class Utility : EllieModule
|
|||
[Ratelimit(3600)]
|
||||
public async Task SaveChat(int cnt)
|
||||
{
|
||||
if (cnt > 1000)
|
||||
if (!_creds.IsOwner(ctx.User) && cnt > 1000)
|
||||
return;
|
||||
|
||||
var msgs = new List<IMessage>(cnt);
|
||||
|
|
|
@ -378,8 +378,8 @@ sargroupdelete:
|
|||
desc: "The number of the group to delete."
|
||||
sarexclusive:
|
||||
desc: |-
|
||||
Toggles whether self-assigned roles are exclusive.
|
||||
While enabled, users can only have one self-assignable role per group.
|
||||
Toggles the sar group as exclusive.
|
||||
While enabled, users can only have one self-assignable role from that group.
|
||||
ex:
|
||||
- '1'
|
||||
params:
|
||||
|
@ -418,7 +418,11 @@ iamnot:
|
|||
- role:
|
||||
desc: "The role to remove."
|
||||
expradd:
|
||||
desc: 'Add an expression with a trigger and a response. Bot will post a response whenever someone types the trigger word. Running this command in a server requires the Administrator permission. Running this command in DM is Bot Owner only and adds a new global expression. Guide [here](<https://docs.elliebot.net/ellie/features/expressions/>)'
|
||||
desc: |-
|
||||
Add an expression with a trigger and a response.
|
||||
Bot will post a response whenever someone types the trigger word.
|
||||
Running this command in a server requires the Administrator permission.
|
||||
Running this command in DM is Bot Owner only and adds a new global expression.
|
||||
ex:
|
||||
- '"hello" Hi there %user.mention%'
|
||||
params:
|
||||
|
@ -427,7 +431,7 @@ expradd:
|
|||
response:
|
||||
desc: "The text of the message that shows up when a user types the trigger word or phrase."
|
||||
expraddserver:
|
||||
desc: 'Add an expression with a trigger and a response in this server. Bot will post a response whenever someone types the trigger word. This command is useful if you want to lower the permission requirement for managing expressions by using `{0}dpo`. Guide [here](<https://docs.elliebot.net/ellie/features/expressions/>).'
|
||||
desc: 'Add an expression with a trigger and a response in this server. Bot will post a response whenever someone types the trigger word. This command is useful if you want to lower the permission requirement for managing expressions by using `{0}dpo`.'
|
||||
ex:
|
||||
- '"hello" Hi there %user.mention%'
|
||||
params:
|
||||
|
@ -892,7 +896,9 @@ send:
|
|||
text:
|
||||
desc: "The recipient's preferred format for the message, such as plain text or formatted text with images and links."
|
||||
savechat:
|
||||
desc: Saves a number of messages to a text file and sends it to you.
|
||||
desc: |-
|
||||
Saves a number of messages to a text file and sends it to you.
|
||||
Max is 1000, unless you're the bot owner.
|
||||
ex:
|
||||
- 150
|
||||
params:
|
||||
|
|
|
@ -621,7 +621,10 @@
|
|||
"quote_deleted": "Quote #{0} deleted.",
|
||||
"quote_edited": "Quote Edited",
|
||||
"region": "Region",
|
||||
"remind2": "I will remind {0} to {1} {2} ({3})",
|
||||
"reminder_created": "Reminder Created",
|
||||
"who_where": "Who / Where",
|
||||
"when": "When",
|
||||
"date2": "Date",
|
||||
"remind_timely": "I will remind you about your timely reward {0}",
|
||||
"timely_button": "Click the button to claim your timely reward.",
|
||||
"remind_invalid": "Not a valid remind format. Remind must have a target, timer and a reason. Check the command list.",
|
||||
|
@ -1203,5 +1206,6 @@
|
|||
"userrole_icon_fail": "Failed to set the role icon.",
|
||||
"userrole_icon_invalid": "The role icon cannot be empty.",
|
||||
"userrole_hierarchy_error": "You can't assign or modify roles that are higher than or equal to your, or bots highest role.",
|
||||
"userrole_role_not_exists": "That role doesn't exist."
|
||||
"userrole_role_not_exists": "That role doesn't exist.",
|
||||
"whos_playing_game": "{0} users are playing {1}"
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue