Skip to content

Commit d4e852f

Browse files
committed
This is V2.0.3.
all commands updated. fixes #17 Welcome system should have less inconsistencies.
1 parent c24601b commit d4e852f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+237
-228
lines changed

Volte/Core/Commands/Modules/Admin/AddRoleCommand.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Discord.Commands;
66
using Discord.WebSocket;
77
using Volte.Core.Commands.Preconditions;
8+
using Volte.Core.Extensions;
89
using Volte.Helpers;
910

1011
namespace Volte.Core.Commands.Modules.Admin {
@@ -14,16 +15,17 @@ public partial class AdminModule : VolteModule {
1415
[Remarks("Usage: |prefix|addrole {@user} {roleName}")]
1516
[RequireGuildAdmin]
1617
public async Task AddRole(SocketGuildUser user, [Remainder] string role) {
17-
var targetRole = Context.Guild.Roles.FirstOrDefault(r => string.Equals(r.Name, role, StringComparison.CurrentCultureIgnoreCase));
18+
var targetRole = Context.Guild.Roles.FirstOrDefault(r =>
19+
string.Equals(r.Name, role, StringComparison.CurrentCultureIgnoreCase));
1820
if (targetRole != null) {
1921
await user.AddRoleAsync(targetRole);
20-
await Reply(Context.Channel,
21-
CreateEmbed(Context, $"Added the role **{role}** to {user.Mention}!"));
22+
await Context.CreateEmbed($"Added the role **{role}** to {user.Mention}!")
23+
.SendTo(Context.Channel);
2224
return;
2325
}
2426

25-
await Reply(Context.Channel,
26-
CreateEmbed(Context, $"**{role}** doesn't exist on this server!"));
27+
await Context.CreateEmbed($"**{role}** doesn't exist on this server!")
28+
.SendTo(Context.Channel);
2729
}
2830
}
2931
}

Volte/Core/Commands/Modules/Admin/AdminRoleCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public partial class AdminModule : VolteModule {
1414
[Remarks("Usage: |prefix|adminrole {roleName}")]
1515
[RequireGuildAdmin]
1616
public async Task AdminRole([Remainder] string roleName) {
17-
var embed = CreateEmbed(Context, string.Empty).ToEmbedBuilder();
17+
var embed = Context.CreateEmbed(string.Empty).ToEmbedBuilder();
1818
var config = Db.GetConfig(Context.Guild);
1919
if (Context.Guild.Roles.Any(r => r.Name.ToLower().Equals(roleName.ToLower()))) {
2020
var role = Context.Guild.Roles.First(r => r.Name == roleName);

Volte/Core/Commands/Modules/Admin/AntilinkCommand.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Discord.Commands;
44
using Volte.Core.Commands.Preconditions;
55
using Volte.Core.Data;
6+
using Volte.Core.Extensions;
67
using Volte.Helpers;
78

89
namespace Volte.Core.Commands.Modules.Admin {
@@ -11,11 +12,12 @@ public partial class AdminModule : VolteModule {
1112
[Summary("Enable/Disable Antilink for the current guild.")]
1213
[Remarks("Usage: |prefix|antilink {true|false}")]
1314
[RequireGuildAdmin]
14-
public async Task Antilink(bool alIsEnabled) {
15+
public async Task Antilink(bool arg) {
1516
var config = Db.GetConfig(Context.Guild);
16-
config.Antilink = alIsEnabled;
17-
var isEnabled = alIsEnabled ? "Antilink has been enabled." : "Antilink has been disabled.";
18-
await Reply(Context.Channel, CreateEmbed(Context, isEnabled));
17+
config.Antilink = arg;
18+
Db.UpdateConfig(config);
19+
await Context.CreateEmbed(arg ? "Antilink has been enabled." : "Antilink has been disabled.")
20+
.SendTo(Context.Channel);
1921
}
2022
}
2123
}

Volte/Core/Commands/Modules/Admin/AutoroleCommand.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@ public partial class AdminModule : VolteModule {
1313
[Summary("Sets the role to be used for Autorole.")]
1414
[Remarks("Usage: |prefix|autorole {roleName}")]
1515
[RequireGuildAdmin]
16-
public async Task Autorole([Remainder]string role) {
16+
public async Task Autorole([Remainder] string role) {
1717
var config = Db.GetConfig(Context.Guild);
1818
var roleToApply = Context.Guild.Roles
1919
.FirstOrDefault(r => r.Name.EqualsIgnoreCase(role));
2020
if (roleToApply is null) {
21-
await Reply(Context.Channel,
22-
CreateEmbed(Context, $"The specified role, **{role}**, doesn't exist on this guild."));
21+
await Context.CreateEmbed($"The specified role, **{role}**, doesn't exist on this guild.")
22+
.SendTo(Context.Channel);
2323
return;
2424
}
2525

2626
config.Autorole = roleToApply.Name;
2727
Db.UpdateConfig(config);
28-
await Reply(Context.Channel, CreateEmbed(Context,
29-
$"Successfully set **{roleToApply.Name}** as the Autorole for this server."));
28+
await Context.CreateEmbed($"Successfully set **{roleToApply.Name}** as the Autorole for this server.")
29+
.SendTo(Context.Channel);
3030
}
3131
}
3232
}

Volte/Core/Commands/Modules/Admin/BlacklistCommands.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public async Task BlacklistAdd([Remainder] string arg) {
1717
var config = Db.GetConfig(Context.Guild);
1818
config.Blacklist.Add(arg);
1919
Db.UpdateConfig(config);
20-
await Reply(Context.Channel, CreateEmbed(Context, $"Added **{arg}** to the blacklist."));
20+
await Context.CreateEmbed($"Added **{arg}** to the blacklist.").SendTo(Context.Channel);
2121
}
2222

2323
[Command("BlacklistRemove"), Alias("BlRem")]
@@ -28,13 +28,11 @@ public async Task BlacklistRemove([Remainder] string arg) {
2828
var config = Db.GetConfig(Context.Guild);
2929
if (config.Blacklist.Any(p => p.EqualsIgnoreCase(arg))) {
3030
config.Blacklist.RemoveAt(config.Blacklist.FindIndex(p => p.EqualsIgnoreCase(arg)));
31-
await Context.Channel.SendMessageAsync(string.Empty, false,
32-
CreateEmbed(Context, $"Removed **{arg}** from the word blacklist."));
31+
await Context.CreateEmbed($"Removed **{arg}** from the word blacklist.").SendTo(Context.Channel);
3332
Db.UpdateConfig(config);
3433
}
3534
else {
36-
await Context.Channel.SendMessageAsync(string.Empty, false,
37-
CreateEmbed(Context, $"**{arg}** doesn't exist in the blacklist."));
35+
await Context.CreateEmbed($"**{arg}** doesn't exist in the blacklist.").SendTo(Context.Channel);
3836
}
3937
}
4038

@@ -44,8 +42,8 @@ await Context.Channel.SendMessageAsync(string.Empty, false,
4442
[RequireGuildAdmin]
4543
public async Task BlacklistClear() {
4644
var config = Db.GetConfig(Context.Guild);
47-
await Reply(Context.Channel,
48-
CreateEmbed(Context, $"Cleared the custom commands, containing **{config.Blacklist.Count}** words."));
45+
await Context.CreateEmbed($"Cleared the custom commands, containing **{config.Blacklist.Count}** words.")
46+
.SendTo(Context.Channel);
4947
config.Blacklist.Clear();
5048
Db.UpdateConfig(config);
5149
}

Volte/Core/Commands/Modules/Admin/CustomCommandCommands.cs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using Discord.Commands;
55
using Volte.Core.Commands.Preconditions;
66
using Volte.Core.Data;
7+
using Volte.Core.Extensions;
78
using Volte.Helpers;
89

910
namespace Volte.Core.Commands.Modules.Admin {
@@ -16,24 +17,22 @@ public async Task CustomCommandAdd(string name, [Remainder] string response) {
1617
var config = Db.GetConfig(Context.Guild);
1718
config.CustomCommands.Add(name, response);
1819
Db.UpdateConfig(config);
19-
await Context.Channel.SendMessageAsync(string.Empty, false,
20-
CreateEmbed(Context, string.Empty)
21-
.ToEmbedBuilder()
22-
.AddField("Command Name", name)
23-
.AddField("Command Response", response)
24-
.Build()
25-
);
20+
await Context.CreateEmbed(string.Empty)
21+
.ToEmbedBuilder()
22+
.AddField("Command Name", name)
23+
.AddField("Command Response", response)
24+
.SendTo(Context.Channel);
2625
}
27-
26+
2827
[Command("CustomCommandRem"), Alias("Ccr")]
2928
[Summary("Remove a custom command from this guild.")]
3029
[Remarks("Usage: |prefix|customcommandrem {cmdName}")]
3130
[RequireGuildAdmin]
3231
public async Task CustomCommandRem(string cmdName) {
3332
var config = Db.GetConfig(Context.Guild);
34-
var embed = CreateEmbed(Context, string.Empty).ToEmbedBuilder()
33+
var embed = Context.CreateEmbed(string.Empty).ToEmbedBuilder()
3534
.WithAuthor(Context.User);
36-
35+
3736
if (config.CustomCommands.Keys.Contains(cmdName)) {
3837
config.CustomCommands.Remove(cmdName);
3938
Db.UpdateConfig(config);
@@ -43,7 +42,7 @@ public async Task CustomCommandRem(string cmdName) {
4342
embed.WithDescription($"**{cmdName}** is not a command on this server.");
4443
}
4544

46-
await Context.Channel.SendMessageAsync(string.Empty, false, embed.Build());
45+
await embed.SendTo(Context.Channel);
4746
}
4847

4948
[Command("CustomCommandClear"), Alias("Ccc")]
@@ -52,9 +51,9 @@ public async Task CustomCommandRem(string cmdName) {
5251
[RequireGuildAdmin]
5352
public async Task CustomCommandClear() {
5453
var config = Db.GetConfig(Context.Guild);
55-
await Context.Channel.SendMessageAsync(string.Empty, false,
56-
CreateEmbed(Context,
57-
$"Cleared the custom commands, containing **{config.CustomCommands.Count}** words."));
54+
await Context
55+
.CreateEmbed($"Cleared the custom commands, containing **{config.CustomCommands.Count}** words.")
56+
.SendTo(Context.Channel);
5857
config.CustomCommands.Clear();
5958
Db.UpdateConfig(config);
6059
}

Volte/Core/Commands/Modules/Admin/DebugCommand.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using Discord.Commands;
33
using Newtonsoft.Json;
44
using Volte.Core.Commands.Preconditions;
5+
using Volte.Core.Extensions;
56
using Volte.Core.Services;
67
using Volte.Helpers;
78

@@ -15,10 +16,10 @@ public partial class AdminModule : VolteModule {
1516
[Remarks("Usage: |prefix|debug")]
1617
[RequireGuildAdmin]
1718
public async Task Debug() {
18-
await Reply(Context.Channel,
19-
CreateEmbed(Context,
19+
await Context.CreateEmbed(
2020
$"{DebugService.Execute(JsonConvert.SerializeObject(Db.GetConfig(Context.Guild), Formatting.Indented))}" +
21-
"\n\nTake this to the Volte guild for support. Join the guild [here](https://greemdev.net/discord)."));
21+
"\n\nTake this to the Volte guild for support. Join the guild [here](https://greemdev.net/discord).")
22+
.SendTo(Context.Channel);
2223
}
2324
}
2425
}

Volte/Core/Commands/Modules/Admin/DeleteMessageOnCommandCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using Volte.Core.Commands.Preconditions;
55
using Volte.Helpers;
66
using Volte.Core.Data;
7+
using Volte.Core.Extensions;
78

89
namespace Volte.Core.Commands.Modules.Admin {
910
public partial class AdminModule : VolteModule {
@@ -15,8 +16,7 @@ public async Task DeleteMessageOnCommand(bool arg) {
1516
var config = Db.GetConfig(Context.Guild);
1617
config.DeleteMessageOnCommand = arg;
1718
Db.UpdateConfig(config);
18-
await Context.Channel.SendMessageAsync(string.Empty, false,
19-
CreateEmbed(Context, $"Set the DeleteMessageOnCommand setting to **{arg}**."));
19+
await Context.CreateEmbed(arg ? "Enabled DeleteMessageOnCommand in this server." : "").SendTo(Context.Channel);
2020
}
2121
}
2222
}

Volte/Core/Commands/Modules/Admin/LevelsCommand.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Discord.Commands;
44
using Volte.Core.Commands.Preconditions;
55
using Volte.Core.Data;
6+
using Volte.Core.Extensions;
67
using Volte.Helpers;
78

89
namespace Volte.Core.Commands.Modules.Admin {
@@ -11,13 +12,12 @@ public partial class AdminModule : VolteModule {
1112
[Summary("Enables/Disables level gaining for this guild.")]
1213
[Remarks("Usage: $levels {true|false}")]
1314
[RequireGuildAdmin]
14-
public async Task Levels(bool enabled) {
15+
public async Task Levels(bool arg) {
1516
var config = Db.GetConfig(Context.Guild);
16-
config.Leveling = enabled;
17+
config.Leveling = arg;
1718
Db.UpdateConfig(config);
18-
await Context.Channel.SendMessageAsync(string.Empty, false,
19-
CreateEmbed(Context,
20-
enabled ? "Enabled Leveling for this server." : "Disabled Leveling for this server."));
19+
await Context.CreateEmbed(arg ? "Leveling has been enabled." : "Leveling has been disabled.")
20+
.SendTo(Context.Channel);
2121

2222
}
2323
}

Volte/Core/Commands/Modules/Admin/ModRoleCommand.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using Discord.Commands;
55
using Volte.Core.Commands.Preconditions;
66
using Volte.Core.Data;
7+
using Volte.Core.Extensions;
78
using Volte.Helpers;
89

910
namespace Volte.Core.Commands.Modules.Admin {
@@ -14,10 +15,10 @@ public partial class AdminModule : VolteModule {
1415
[RequireGuildAdmin]
1516
public async Task ModRole([Remainder] string roleName) {
1617
var config = Db.GetConfig(Context.Guild);
17-
var embed = CreateEmbed(Context, string.Empty).ToEmbedBuilder();
18+
var embed = Context.CreateEmbed(string.Empty).ToEmbedBuilder();
1819

19-
if (Context.Guild.Roles.Any(r => r.Name.ToLower() == roleName.ToLower())) {
20-
var role = Context.Guild.Roles.First(r => r.Name.ToLower() == roleName.ToLower());
20+
if (Context.Guild.Roles.Any(r => r.Name.EqualsIgnoreCase(roleName))) {
21+
var role = Context.Guild.Roles.First(r => r.Name.EqualsIgnoreCase(roleName));
2122
config.ModRole = role.Id;
2223
Db.UpdateConfig(config);
2324
embed.WithDescription($"Set **{role.Name}** as the Moderator role for this server.");
@@ -26,7 +27,7 @@ public async Task ModRole([Remainder] string roleName) {
2627
embed.WithDescription($"{roleName} doesn't exist in this server.");
2728
}
2829

29-
await Context.Channel.SendMessageAsync(string.Empty, false, embed.Build());
30+
await embed.SendTo(Context.Channel);
3031
}
3132
}
3233
}

0 commit comments

Comments
 (0)