-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update dependencies and modules #169
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -269,3 +269,5 @@ __pycache__/ | |
|
||
Floofbot/config.yaml | ||
/Floofbot/floofData.db | ||
/Floofbot/config.yaml | ||
/Floofbot/app.config |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -253,8 +253,9 @@ public Task MessageUpdated(Cacheable<IMessage, ulong> before, SocketMessage afte | |
}); | ||
return Task.CompletedTask; | ||
} | ||
public Task MessageDeleted(Cacheable<IMessage, ulong> before, ISocketMessageChannel chan) | ||
public Task MessageDeleted(Cacheable<IMessage, ulong> before, Cacheable<IMessageChannel, ulong> channel) | ||
{ | ||
IMessageChannel chan = channel.Value; | ||
var _ = Task.Run(async () => | ||
{ | ||
try | ||
|
@@ -267,23 +268,25 @@ public Task MessageDeleted(Cacheable<IMessage, ulong> before, ISocketMessageChan | |
if (message.Author.IsBot) | ||
return; | ||
|
||
var channel = chan as ITextChannel; // channel null, dm message? | ||
if (channel == null) | ||
if (chan == null) | ||
return; | ||
|
||
if ((IsToggled(channel.Guild)) == false) // not toggled on | ||
IGuildChannel messageChannel = message.Channel as IGuildChannel; | ||
IGuild guild = messageChannel.Guild; | ||
|
||
if ((IsToggled(guild)) == false) // not toggled on | ||
return; | ||
|
||
|
||
Discord.ITextChannel logChannel = await GetChannel(channel.Guild, "MessageDeletedChannel"); | ||
Discord.ITextChannel logChannel = await GetChannel(guild, "MessageDeletedChannel"); | ||
if (logChannel == null) | ||
return; | ||
|
||
var embed = new EmbedBuilder(); | ||
|
||
embed.WithTitle($"⚠️ Message Deleted | {message.Author.Username}#{message.Author.Discriminator}") | ||
.WithColor(Color.Gold) | ||
.WithDescription($"{message.Author.Mention} ({message.Author.Id}) has had their message deleted in {channel.Mention}!") | ||
.WithDescription($"{message.Author.Mention} ({message.Author.Id}) has had their message deleted in {MentionUtils.MentionChannel(chan.Id)}!") | ||
.WithCurrentTimestamp() | ||
.WithFooter($"user_message_deleted user_messagelog {message.Author.Id}"); | ||
if (message.Content.Length > 0) | ||
|
@@ -437,8 +440,10 @@ public Task UserUnbanned(IUser user, IGuild guild) | |
return Task.CompletedTask; | ||
|
||
} | ||
public Task UserJoined(IGuildUser user) | ||
public Task UserJoined(SocketGuildUser sUser) | ||
{ | ||
SocketGuild guild = sUser.Guild; | ||
IGuildUser user = guild.GetUser(sUser.Id); | ||
var _ = Task.Run(async () => | ||
{ | ||
try | ||
|
@@ -482,7 +487,7 @@ public Task UserJoined(IGuildUser user) | |
}); | ||
return Task.CompletedTask; | ||
} | ||
public Task UserLeft(IGuildUser user) | ||
public Task UserLeft(SocketGuild guild, SocketUser user) | ||
{ | ||
var _ = Task.Run(async () => | ||
{ | ||
|
@@ -491,27 +496,18 @@ public Task UserLeft(IGuildUser user) | |
if (user.IsBot) | ||
return; | ||
|
||
await _userRoleRetentionService.LogUserRoles(user); | ||
|
||
if ((IsToggled(user.Guild)) == false) | ||
if ((IsToggled(guild)) == false) | ||
return; | ||
|
||
Discord.ITextChannel channel = await GetChannel(user.Guild, "UserLeftChannel"); | ||
Discord.ITextChannel channel = await GetChannel(guild, "UserLeftChannel"); | ||
if (channel == null) | ||
return; | ||
|
||
var embed = new EmbedBuilder(); | ||
embed.WithTitle($"❌ User Left | {user.Username}#{user.Discriminator}") | ||
.WithColor(Color.Red) | ||
.WithDescription($"{user.Mention} | ``{user.Id}``"); | ||
if (user.JoinedAt != null) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So what happened to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because it's changed from guilduser to socketuser, this no longer knows the join date as the user isn't associated with a guild, couldn't think of alternative solution but to remove it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is really late, but you can actually get the |
||
{ | ||
DateTimeOffset userJoined = ((DateTimeOffset)user.JoinedAt); | ||
TimeSpan interval = DateTime.UtcNow - userJoined.DateTime; | ||
string day_word = interval.Days == 1 ? "day" : "days"; | ||
embed.AddField("Joined Server", userJoined.ToString("ddd, dd MMM yyyy"), true); | ||
embed.AddField("Time at Server", $"{interval.Days} {day_word}", true); | ||
} | ||
embed.WithFooter($"user_leave user_joinlog {user.Id}") | ||
.WithCurrentTimestamp(); | ||
|
||
|
@@ -603,8 +599,9 @@ public Task UserUpdated(SocketUser before, SocketUser userAfter) | |
|
||
} | ||
|
||
public Task GuildMemberUpdated(SocketGuildUser before, SocketGuildUser after) | ||
public Task GuildMemberUpdated(Cacheable<SocketGuildUser, ulong> _before, SocketGuildUser after) | ||
{ | ||
SocketGuildUser before = _before.Value; | ||
var _ = Task.Run(async () => | ||
{ | ||
try | ||
|
@@ -656,6 +653,8 @@ public Task GuildMemberUpdated(SocketGuildUser before, SocketGuildUser after) | |
} | ||
else if (before.Roles.Count != after.Roles.Count) | ||
{ | ||
await _userRoleRetentionService.LogUserRoles(before as IGuildUser); | ||
|
||
List<SocketRole> beforeRoles = new List<SocketRole>(before.Roles); | ||
List<SocketRole> afterRoles = new List<SocketRole>(after.Roles); | ||
List<SocketRole> roleDifference = new List<SocketRole>(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iShauny i opened #174. ptal.