mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 09:18:27 -04:00
.serverinfo improved, updated changelog, added seconds to .convert
This commit is contained in:
@@ -34,10 +34,13 @@ Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.
|
|||||||
- For self-hosters:
|
- For self-hosters:
|
||||||
- Added `.sqlselectcsv` which will return results in a csv file instead of an embed.
|
- Added `.sqlselectcsv` which will return results in a csv file instead of an embed.
|
||||||
- Added a page parameter to `.feedlist`
|
- Added a page parameter to `.feedlist`
|
||||||
|
- Added seconds/sec/s to .convert command
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Users who have manage messages perm in the channel will now be excluded from link and invite filtering (`.sfi` and `.sfl`)
|
- Users who have manage messages perm in the channel will now be excluded from link and invite filtering (`.sfi` and `.sfl`)
|
||||||
|
- `.send` command should work consistently and correctly now. You can have targets from other shards too. The usage has been changed. refer to `.h .send` for more info
|
||||||
|
- `.serverinfo` no longer takes a server name. It only takes an id or no arguments
|
||||||
- You can now target a different channel with .repeat, for example `.repeat #some-other 1h Hello every hour`
|
- You can now target a different channel with .repeat, for example `.repeat #some-other 1h Hello every hour`
|
||||||
- `.cmds <module name>`, `.cmds <group name` and `.mdls` looks better / cleaner / simpler
|
- `.cmds <module name>`, `.cmds <group name` and `.mdls` looks better / cleaner / simpler
|
||||||
- The bot will now send a discord Reply to every command
|
- The bot will now send a discord Reply to every command
|
||||||
@@ -48,6 +51,8 @@ Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.
|
|||||||
- `.feed` should now correctly accept (and show) the message which can be passed as the third parameter
|
- `.feed` should now correctly accept (and show) the message which can be passed as the third parameter
|
||||||
- `.say` will now correctly report errors if the user or the bot don't have sufficent perms to send a message in the targeted channel
|
- `.say` will now correctly report errors if the user or the bot don't have sufficent perms to send a message in the targeted channel
|
||||||
- Fixed a bug in .invitelist not paginating correctly
|
- Fixed a bug in .invitelist not paginating correctly
|
||||||
|
- `.serverinfo` will now correctly work for other shards
|
||||||
|
- `.send` will now correctly work for other shards
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
@@ -33,7 +33,7 @@ public partial class Permissions
|
|||||||
?? ""),
|
?? ""),
|
||||||
BlacklistType.User => Format.Code(i.ItemId.ToString())
|
BlacklistType.User => Format.Code(i.ItemId.ToString())
|
||||||
+ " "
|
+ " "
|
||||||
+ ((await _client.Rest.GetUserAsync(i.ItemId))
|
+ ((_client.GetUser(i.ItemId))
|
||||||
?.ToString()
|
?.ToString()
|
||||||
?? ""),
|
?? ""),
|
||||||
BlacklistType.Server => Format.Code(i.ItemId.ToString())
|
BlacklistType.Server => Format.Code(i.ItemId.ToString())
|
||||||
|
@@ -22,31 +22,25 @@ public partial class Utility
|
|||||||
|
|
||||||
[Cmd]
|
[Cmd]
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
public Task ServerInfo([Leftover] string guildName)
|
public Task ServerInfo(ulong guildId)
|
||||||
=> InternalServerInfo(guildName);
|
=> InternalServerInfo(guildId);
|
||||||
|
|
||||||
[Cmd]
|
[Cmd]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
public Task ServerInfo()
|
public Task ServerInfo()
|
||||||
=> InternalServerInfo();
|
=> InternalServerInfo(ctx.Guild.Id);
|
||||||
|
|
||||||
private async Task InternalServerInfo(string guildName = null)
|
private async Task InternalServerInfo(ulong guildId)
|
||||||
{
|
{
|
||||||
var channel = (ITextChannel)ctx.Channel;
|
var guild = (IGuild)_client.GetGuild(guildId)
|
||||||
guildName = guildName?.ToUpperInvariant();
|
?? await _client.Rest.GetGuildAsync(guildId);
|
||||||
SocketGuild guild;
|
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(guildName))
|
|
||||||
guild = (SocketGuild)channel.Guild;
|
|
||||||
else
|
|
||||||
guild = _client.Guilds.FirstOrDefault(g => g.Name.ToUpperInvariant() == guildName.ToUpperInvariant());
|
|
||||||
|
|
||||||
if (guild is null)
|
if (guild is null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var ownername = guild.GetUser(guild.OwnerId);
|
var ownername = await guild.GetUserAsync(guild.OwnerId);
|
||||||
var textchn = guild.TextChannels.Count;
|
var textchn = (await guild.GetTextChannelsAsync()).Count;
|
||||||
var voicechn = guild.VoiceChannels.Count;
|
var voicechn = (await guild.GetVoiceChannelsAsync()).Count;
|
||||||
var channels = $@"{GetText(strs.text_channels(textchn))}
|
var channels = $@"{GetText(strs.text_channels(textchn))}
|
||||||
{GetText(strs.voice_channels(voicechn))}";
|
{GetText(strs.voice_channels(voicechn))}";
|
||||||
var createdAt = new DateTime(2015, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds(guild.Id >> 22);
|
var createdAt = new DateTime(2015, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds(guild.Id >> 22);
|
||||||
@@ -55,16 +49,16 @@ public partial class Utility
|
|||||||
features = "-";
|
features = "-";
|
||||||
|
|
||||||
var embed = _sender.CreateEmbed()
|
var embed = _sender.CreateEmbed()
|
||||||
.WithAuthor(GetText(strs.server_info))
|
.WithAuthor(GetText(strs.server_info))
|
||||||
.WithTitle(guild.Name)
|
.WithTitle(guild.Name)
|
||||||
.AddField(GetText(strs.id), guild.Id.ToString(), true)
|
.AddField(GetText(strs.id), guild.Id.ToString(), true)
|
||||||
.AddField(GetText(strs.owner), ownername.ToString(), true)
|
.AddField(GetText(strs.owner), ownername.ToString(), true)
|
||||||
.AddField(GetText(strs.members), guild.MemberCount.ToString(), true)
|
.AddField(GetText(strs.members), (guild as SocketGuild)?.MemberCount ?? guild.ApproximateMemberCount, true)
|
||||||
.AddField(GetText(strs.channels), channels, true)
|
.AddField(GetText(strs.channels), channels, true)
|
||||||
.AddField(GetText(strs.created_at), $"{createdAt:dd.MM.yyyy HH:mm}", true)
|
.AddField(GetText(strs.created_at), $"{createdAt:dd.MM.yyyy HH:mm}", true)
|
||||||
.AddField(GetText(strs.roles), (guild.Roles.Count - 1).ToString(), true)
|
.AddField(GetText(strs.roles), (guild.Roles.Count - 1).ToString(), true)
|
||||||
.AddField(GetText(strs.features), features)
|
.AddField(GetText(strs.features), features)
|
||||||
.WithOkColor();
|
.WithOkColor();
|
||||||
|
|
||||||
if (Uri.IsWellFormedUriString(guild.IconUrl, UriKind.Absolute))
|
if (Uri.IsWellFormedUriString(guild.IconUrl, UriKind.Absolute))
|
||||||
embed.WithThumbnailUrl(guild.IconUrl);
|
embed.WithThumbnailUrl(guild.IconUrl);
|
||||||
@@ -88,12 +82,12 @@ public partial class Utility
|
|||||||
var createdAt = new DateTime(2015, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds(ch.Id >> 22);
|
var createdAt = new DateTime(2015, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds(ch.Id >> 22);
|
||||||
var usercount = (await ch.GetUsersAsync().FlattenAsync()).Count();
|
var usercount = (await ch.GetUsersAsync().FlattenAsync()).Count();
|
||||||
var embed = _sender.CreateEmbed()
|
var embed = _sender.CreateEmbed()
|
||||||
.WithTitle(ch.Name)
|
.WithTitle(ch.Name)
|
||||||
.WithDescription(ch.Topic?.SanitizeMentions(true))
|
.WithDescription(ch.Topic?.SanitizeMentions(true))
|
||||||
.AddField(GetText(strs.id), ch.Id.ToString(), true)
|
.AddField(GetText(strs.id), ch.Id.ToString(), true)
|
||||||
.AddField(GetText(strs.created_at), $"{createdAt:dd.MM.yyyy HH:mm}", true)
|
.AddField(GetText(strs.created_at), $"{createdAt:dd.MM.yyyy HH:mm}", true)
|
||||||
.AddField(GetText(strs.users), usercount.ToString(), true)
|
.AddField(GetText(strs.users), usercount.ToString(), true)
|
||||||
.WithOkColor();
|
.WithOkColor();
|
||||||
await Response().Embed(embed).SendAsync();
|
await Response().Embed(embed).SendAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,15 +102,17 @@ public partial class Utility
|
|||||||
.AddMilliseconds(role.Id >> 22);
|
.AddMilliseconds(role.Id >> 22);
|
||||||
var usercount = role.Members.LongCount();
|
var usercount = role.Members.LongCount();
|
||||||
var embed = _sender.CreateEmbed()
|
var embed = _sender.CreateEmbed()
|
||||||
.WithTitle(role.Name.TrimTo(128))
|
.WithTitle(role.Name.TrimTo(128))
|
||||||
.WithDescription(role.Permissions.ToList().Join(" | "))
|
.WithDescription(role.Permissions.ToList().Join(" | "))
|
||||||
.AddField(GetText(strs.id), role.Id.ToString(), true)
|
.AddField(GetText(strs.id), role.Id.ToString(), true)
|
||||||
.AddField(GetText(strs.created_at), $"{createdAt:dd.MM.yyyy HH:mm}", true)
|
.AddField(GetText(strs.created_at), $"{createdAt:dd.MM.yyyy HH:mm}", true)
|
||||||
.AddField(GetText(strs.users), usercount.ToString(), true)
|
.AddField(GetText(strs.users), usercount.ToString(), true)
|
||||||
.AddField(GetText(strs.color), $"#{role.Color.R:X2}{role.Color.G:X2}{role.Color.B:X2}", true)
|
.AddField(GetText(strs.color),
|
||||||
.AddField(GetText(strs.mentionable), role.IsMentionable.ToString(), true)
|
$"#{role.Color.R:X2}{role.Color.G:X2}{role.Color.B:X2}",
|
||||||
.AddField(GetText(strs.hoisted), role.IsHoisted.ToString(), true)
|
true)
|
||||||
.WithOkColor();
|
.AddField(GetText(strs.mentionable), role.IsMentionable.ToString(), true)
|
||||||
|
.AddField(GetText(strs.hoisted), role.IsHoisted.ToString(), true)
|
||||||
|
.WithOkColor();
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(role.GetIconUrl()))
|
if (!string.IsNullOrWhiteSpace(role.GetIconUrl()))
|
||||||
embed = embed.WithThumbnailUrl(role.GetIconUrl());
|
embed = embed.WithThumbnailUrl(role.GetIconUrl());
|
||||||
@@ -133,7 +129,8 @@ public partial class Utility
|
|||||||
if (user is null)
|
if (user is null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var embed = _sender.CreateEmbed().AddField(GetText(strs.name), $"**{user.Username}**#{user.Discriminator}", true);
|
var embed = _sender.CreateEmbed()
|
||||||
|
.AddField(GetText(strs.name), $"**{user.Username}**#{user.Discriminator}", true);
|
||||||
if (!string.IsNullOrWhiteSpace(user.Nickname))
|
if (!string.IsNullOrWhiteSpace(user.Nickname))
|
||||||
embed.AddField(GetText(strs.nickname), user.Nickname, true);
|
embed.AddField(GetText(strs.nickname), user.Nickname, true);
|
||||||
|
|
||||||
@@ -204,12 +201,14 @@ public partial class Utility
|
|||||||
kvp.Value)));
|
kvp.Value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
await Response().Embed(_sender.CreateEmbed()
|
await Response()
|
||||||
.WithTitle(GetText(strs.activity_page(page + 1)))
|
.Embed(_sender.CreateEmbed()
|
||||||
.WithOkColor()
|
.WithTitle(GetText(strs.activity_page(page + 1)))
|
||||||
.WithFooter(GetText(
|
.WithOkColor()
|
||||||
strs.activity_users_total(_cmdHandler.UserMessagesSent.Count)))
|
.WithFooter(GetText(
|
||||||
.WithDescription(str.ToString())).SendAsync();
|
strs.activity_users_total(_cmdHandler.UserMessagesSent.Count)))
|
||||||
|
.WithDescription(str.ToString()))
|
||||||
|
.SendAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -422,8 +422,7 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
await _sender.Response(chan)
|
await _sender.Response(chan)
|
||||||
.Confirm(
|
.Confirm(_strings.GetText(strs.level_up_global(user.Mention,
|
||||||
_strings.GetText(strs.level_up_global(user.Mention,
|
|
||||||
Format.Bold(newLevel.ToString())),
|
Format.Bold(newLevel.ToString())),
|
||||||
guild.Id))
|
guild.Id))
|
||||||
.SendAsync();
|
.SendAsync();
|
||||||
|
@@ -13,7 +13,7 @@ namespace NadekoBot.Common.Configs;
|
|||||||
public sealed partial class BotConfig : ICloneable<BotConfig>
|
public sealed partial class BotConfig : ICloneable<BotConfig>
|
||||||
{
|
{
|
||||||
[Comment("""DO NOT CHANGE""")]
|
[Comment("""DO NOT CHANGE""")]
|
||||||
public int Version { get; set; } = 5;
|
public int Version { get; set; } = 6;
|
||||||
|
|
||||||
[Comment("""
|
[Comment("""
|
||||||
Most commands, when executed, have a small colored line
|
Most commands, when executed, have a small colored line
|
||||||
|
@@ -437,9 +437,9 @@ remindlist:
|
|||||||
- "1"
|
- "1"
|
||||||
- "server 2"
|
- "server 2"
|
||||||
serverinfo:
|
serverinfo:
|
||||||
desc: "Shows info about the server the bot is on. If no server is supplied, it defaults to current one."
|
desc: "Shows info about the server with the specified ID. The bot has to be on that server. If no server is supplied, it defaults to current one."
|
||||||
args:
|
args:
|
||||||
- "Some Server"
|
- "123123132233"
|
||||||
channelinfo:
|
channelinfo:
|
||||||
desc: "Shows info about the channel. If no channel is supplied, it defaults to current one."
|
desc: "Shows info about the channel. If no channel is supplied, it defaults to current one."
|
||||||
args:
|
args:
|
||||||
|
@@ -719,6 +719,17 @@
|
|||||||
"UnitType": "time",
|
"UnitType": "time",
|
||||||
"Modifier": 60.0
|
"Modifier": 60.0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"Triggers": [
|
||||||
|
"second",
|
||||||
|
"seconds",
|
||||||
|
"sec",
|
||||||
|
"secs",
|
||||||
|
"s"
|
||||||
|
],
|
||||||
|
"UnitType": "time",
|
||||||
|
"Modifier": 1
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"Triggers": [
|
"Triggers": [
|
||||||
"year",
|
"year",
|
||||||
|
Reference in New Issue
Block a user