diff --git a/src/Pootis-Bot/Core/Bot.cs b/src/Pootis-Bot/Core/Bot.cs
index 562cf46a..266fca20 100644
--- a/src/Pootis-Bot/Core/Bot.cs
+++ b/src/Pootis-Bot/Core/Bot.cs
@@ -40,7 +40,8 @@ public async Task StartBot()
Client = new DiscordSocketClient(new DiscordSocketConfig
{
- LogLevel = LogSeverity.Verbose
+ LogLevel = LogSeverity.Verbose,
+ GatewayIntents = Config.bot.GatewayIntents
});
Logger.Debug("Setting up events");
diff --git a/src/Pootis-Bot/Entities/ConfigFile.cs b/src/Pootis-Bot/Entities/ConfigFile.cs
index e8c93257..ea5b4fe2 100644
--- a/src/Pootis-Bot/Entities/ConfigFile.cs
+++ b/src/Pootis-Bot/Entities/ConfigFile.cs
@@ -1,4 +1,5 @@
-using Newtonsoft.Json;
+using Discord;
+using Newtonsoft.Json;
using Pootis_Bot.Attributes;
using Pootis_Bot.Structs.Config;
@@ -88,5 +89,12 @@ public class ConfigFile
/// Setting related to voting
///
public VoteSettings VoteSettings;
+
+ ///
+ /// Gateway intents
+ ///
+ public GatewayIntents GatewayIntents { get; set; } = GatewayIntents.AllUnprivileged |
+ GatewayIntents.GuildMembers |
+ GatewayIntents.GuildPresences;
}
}
\ No newline at end of file
diff --git a/src/Pootis-Bot/Events/MessageEvents.cs b/src/Pootis-Bot/Events/MessageEvents.cs
index 8b5241d6..ff55eb4c 100644
--- a/src/Pootis-Bot/Events/MessageEvents.cs
+++ b/src/Pootis-Bot/Events/MessageEvents.cs
@@ -14,20 +14,20 @@ namespace Pootis_Bot.Events
///
public class MessageEvents
{
- public async Task MessageDeleted(Cacheable cache, ISocketMessageChannel channel)
+ public async Task MessageDeleted(Cacheable messageCache, Cacheable channel)
{
try
{
- SocketGuild guild = ((SocketGuildChannel) channel).Guild;
+ SocketGuild guild = ((SocketGuildChannel) channel.Value).Guild;
ServerList server = ServerListsManager.GetServer(guild);
- if (cache.Id == server.RuleMessageId)
+ if (messageCache.Id == server.RuleMessageId)
{
//The rule reaction will be disabled and the owner of the guild will be notified.
server.RuleEnabled = false;
ServerListsManager.SaveServerList();
- IDMChannel dm = await guild.Owner.GetOrCreateDMChannelAsync();
+ IDMChannel dm = await guild.Owner.CreateDMChannelAsync();
await dm.SendMessageAsync(
$"Your rule reaction on the Discord server **{guild.Name}** has been disabled due to the message being deleted.\n" +
"You can enable it again after setting a new reaction message with the command `setuprulesmessage` and then enabling the feature again with `togglerulereaction`.");
@@ -40,11 +40,11 @@ await dm.SendMessageAsync(
}
public async Task MessageBulkDeleted(IReadOnlyCollection> cacheable,
- ISocketMessageChannel channel)
+ Cacheable channel)
{
try
{
- SocketGuild guild = ((SocketGuildChannel) channel).Guild;
+ SocketGuild guild = ((SocketGuildChannel) channel.Value).Guild;
ServerList server = ServerListsManager.GetServer(guild);
//Depending on how many message were deleted, this could take awhile. Or well I assume that, it would need to be tested
@@ -57,7 +57,7 @@ public async Task MessageBulkDeleted(IReadOnlyCollection
public class ReactionEvents
{
- public Task ReactionAdded(Cacheable cache, ISocketMessageChannel channel,
+ public Task ReactionAdded(Cacheable cache, Cacheable channel,
SocketReaction reaction)
{
try
@@ -35,7 +35,7 @@ public Task ReactionAdded(Cacheable cache, ISocketMessageCh
if (reaction.MessageId == 0)
return Task.CompletedTask;
- SocketGuild guild = ((SocketGuildChannel) channel).Guild;
+ SocketGuild guild = ((SocketGuildChannel) channel.Value).Guild;
ServerList server = ServerListsManager.GetServer(guild);
//If the message the user reacted to is the rules message
diff --git a/src/Pootis-Bot/Events/RoleEvents.cs b/src/Pootis-Bot/Events/RoleEvents.cs
index 6959a299..c7fe02ef 100644
--- a/src/Pootis-Bot/Events/RoleEvents.cs
+++ b/src/Pootis-Bot/Events/RoleEvents.cs
@@ -26,7 +26,7 @@ public async Task RoleDeleted(SocketRole role)
ServerList server = ServerListsManager.GetServer(guild);
//Setup the dm channel even though we might not even use it just makes it so I don't have to repeat this a whole bunch of times.
- IDMChannel dm = await guild.Owner.GetOrCreateDMChannelAsync();
+ IDMChannel dm = await guild.Owner.CreateDMChannelAsync();
//The rule role was deleted
if (role.Id == server.RuleRoleId)
@@ -83,7 +83,7 @@ public async Task RoleUpdated(SocketRole before, SocketRole after)
SocketGuild guild = before.Guild;
ServerList server = ServerListsManager.GetServer(guild);
- IDMChannel dm = await guild.Owner.GetOrCreateDMChannelAsync();
+ IDMChannel dm = await guild.Owner.CreateDMChannelAsync();
//Check all server role pings to make sure they are still mentionable
List rolesToRemove = server.RoleToRoleMentions
diff --git a/src/Pootis-Bot/Events/UserEvents.cs b/src/Pootis-Bot/Events/UserEvents.cs
index a728614c..dda7ecc6 100644
--- a/src/Pootis-Bot/Events/UserEvents.cs
+++ b/src/Pootis-Bot/Events/UserEvents.cs
@@ -66,13 +66,13 @@ public async Task UserJoined(SocketGuildUser user)
}
}
- public async Task UserLeft(SocketGuildUser user)
+ public async Task UserLeft(SocketGuild guild, SocketUser user)
{
try
{
if (!user.IsBot)
{
- ServerList server = ServerListsManager.GetServer(user.Guild);
+ ServerList server = ServerListsManager.GetServer(guild);
if (server.GoodbyeMessageEnabled)
{
//Format the message
diff --git a/src/Pootis-Bot/Modules/Account/AccountDataManagement.cs b/src/Pootis-Bot/Modules/Account/AccountDataManagement.cs
index e22974f3..8043204a 100644
--- a/src/Pootis-Bot/Modules/Account/AccountDataManagement.cs
+++ b/src/Pootis-Bot/Modules/Account/AccountDataManagement.cs
@@ -36,7 +36,7 @@ await Context.Channel.SendMessageAsync(
File.WriteAllText($"temp/{Context.User.Id}.json", json);
//Get the user's dm and send the file
- IDMChannel dm = await Context.User.GetOrCreateDMChannelAsync();
+ IDMChannel dm = await Context.User.CreateDMChannelAsync();
await dm.SendFileAsync($"temp/{Context.User.Id}.json", "Here is your user data, all in one JSON file!");
//Delete the file
diff --git a/src/Pootis-Bot/Modules/Server/Setup/ServerSetupQuick.cs b/src/Pootis-Bot/Modules/Server/Setup/ServerSetupQuick.cs
index 83508d2b..ee86aff5 100644
--- a/src/Pootis-Bot/Modules/Server/Setup/ServerSetupQuick.cs
+++ b/src/Pootis-Bot/Modules/Server/Setup/ServerSetupQuick.cs
@@ -146,8 +146,7 @@ private async Task SetupServerQuick(SocketGuild guild, ISocketMessageChannel cha
else
{
//create a new role called member
- memberRole = await guild.CreateRoleAsync("Member", memberRoleGuildPermissions, Color.LightGrey, false,
- null);
+ memberRole = await guild.CreateRoleAsync("Member", memberRoleGuildPermissions, Color.LightGrey);
}
//Modify @everyone role
diff --git a/src/Pootis-Bot/Modules/Server/Setup/ServerSetupStatus.cs b/src/Pootis-Bot/Modules/Server/Setup/ServerSetupStatus.cs
index 8cbb5196..39338b67 100644
--- a/src/Pootis-Bot/Modules/Server/Setup/ServerSetupStatus.cs
+++ b/src/Pootis-Bot/Modules/Server/Setup/ServerSetupStatus.cs
@@ -26,7 +26,7 @@ public class ServerSetupStatus : ModuleBase
[RequireGuildOwner]
public async Task Setup()
{
- IDMChannel dm = await Context.User.GetOrCreateDMChannelAsync();
+ IDMChannel dm = await Context.User.CreateDMChannelAsync();
ServerList server = ServerListsManager.GetServer(Context.Guild);
EmbedBuilder embed = new EmbedBuilder();
@@ -115,7 +115,7 @@ public async Task Setup()
[RequireGuildOwner]
public async Task SetupSpam()
{
- IDMChannel dm = await Context.User.GetOrCreateDMChannelAsync();
+ IDMChannel dm = await Context.User.CreateDMChannelAsync();
ServerList server = ServerListsManager.GetServer(Context.Guild);
EmbedBuilder embed = new EmbedBuilder();
diff --git a/src/Pootis-Bot/Pootis-Bot.csproj b/src/Pootis-Bot/Pootis-Bot.csproj
index d3f761bb..d5b0343b 100644
--- a/src/Pootis-Bot/Pootis-Bot.csproj
+++ b/src/Pootis-Bot/Pootis-Bot.csproj
@@ -34,11 +34,11 @@
-
+
-
+
diff --git a/src/Pootis-Bot/Services/BotCheckServerSettings.cs b/src/Pootis-Bot/Services/BotCheckServerSettings.cs
index b7758e2c..b70132f9 100644
--- a/src/Pootis-Bot/Services/BotCheckServerSettings.cs
+++ b/src/Pootis-Bot/Services/BotCheckServerSettings.cs
@@ -86,7 +86,7 @@ public static async Task CheckServerWelcomeSettings(ServerList server)
if (client.GetChannel(server.WelcomeChannelId) == null && server.WelcomeMessageEnabled)
{
SocketGuild guild = client.GetGuild(server.GuildId);
- IDMChannel ownerDm = await client.GetGuild(server.GuildId).Owner.GetOrCreateDMChannelAsync();
+ IDMChannel ownerDm = await client.GetGuild(server.GuildId).Owner.CreateDMChannelAsync();
await ownerDm.SendMessageAsync(
$"{guild.Owner.Mention}, your server **{guild.Name}** welcome channel has been disabled due to that it no longer exist since the last bot up time.\n" +
@@ -175,7 +175,7 @@ public static async Task CheckServerRuleMessageChannel(ServerList server)
ServerListsManager.SaveServerList();
- IDMChannel dm = await client.GetGuild(server.GuildId).Owner.GetOrCreateDMChannelAsync();
+ IDMChannel dm = await client.GetGuild(server.GuildId).Owner.CreateDMChannelAsync();
await dm.SendMessageAsync(
$"Your rule reaction on the Discord server **{client.GetGuild(server.GuildId).Name}** has been disabled due to the message being deleted.\n" +
"You can enable it again after setting a new reaction message with the command `setuprulesmessage` and then enabling the feature again with `togglerulereaction`.");
diff --git a/src/Pootis-Bot/Services/ReminderService.cs b/src/Pootis-Bot/Services/ReminderService.cs
index 8d28d032..a78fb303 100644
--- a/src/Pootis-Bot/Services/ReminderService.cs
+++ b/src/Pootis-Bot/Services/ReminderService.cs
@@ -22,7 +22,7 @@ public static async Task RemindAsyncSeconds(SocketUser guild, int time, string m
await Task.Delay(convert);
- IDMChannel dm = await guild.GetOrCreateDMChannelAsync();
+ IDMChannel dm = await guild.CreateDMChannelAsync();
EmbedBuilder embed = new EmbedBuilder();
embed.WithTitle("Reminder");
diff --git a/src/Pootis-Bot/Services/Voting/VotingService.cs b/src/Pootis-Bot/Services/Voting/VotingService.cs
index 99fe6804..d1f3a8e9 100644
--- a/src/Pootis-Bot/Services/Voting/VotingService.cs
+++ b/src/Pootis-Bot/Services/Voting/VotingService.cs
@@ -179,7 +179,7 @@ public static async Task EndVote(Vote vote, SocketGuild guild)
userDmEmbed.WithDescription($"Your vote that you started on the **{guild.Name}** guild is now over.\n" +
$"You can see the results [here](https://discordapp.com/channels/{guild.Id}/{vote.VoteMessageChannelId}/{vote.VoteMessageId}).");
- IDMChannel userDm = await user.GetOrCreateDMChannelAsync();
+ IDMChannel userDm = await user.CreateDMChannelAsync();
await userDm.SendMessageAsync("", false, userDmEmbed.Build());
}