Ejemplo n.º 1
0
 public async void _client_UserUpdated(object s, UserUpdatedEventArgs e)
 {
     if (e.Before.Status.Value == "offline" &&
         e.After.Status.Value == "online" &&
         e.After.ServerPermissions.ManageChannels == true)
     {
         await e.After.Server.GetChannel(_config.Channels["general"]).SendMessage($"Welcome back {e.After.Mention}!");
     }
 }
Ejemplo n.º 2
0
 private void DiscordClient_UserUpdated(object sender, UserUpdatedEventArgs e)
 {
     try
     {
         if (UserUpdated != null)
         {
             OnEvent(UserUpdated, new UserUpdatedEventArgs(e.Before, e.After));
         }
     }
     catch (Exception exception)
     {
         App.LogUnhandledError(exception);
     }
 }
Ejemplo n.º 3
0
 private void Client_UserUpdated(object sender, UserUpdatedEventArgs e)
 {
     if(e.After.Name != e.Before.Name)
     {
         SendMessageAfterDelay(Options.DiscordOptions.SteamChat, string.Format("{0} has changed their name in Discord to {1}", e.Before.Name, e.After.Name), true);
     }
 }
Ejemplo n.º 4
0
        private async void UsrUpdtd(object sender, UserUpdatedEventArgs e)
        {
            try
            {
                Channel ch;
                if (loggingPresences.TryGetValue(e.Server, out ch))
                    if (e.Before.Status != e.After.Status)
                    {
                        await ch.SendMessage($"**{e.Before.Name}** is now **{e.After.Status}**.");
                    }
            }
            catch { }

            try
            {
                if (e.Before.VoiceChannel != null && voiceChannelLog.ContainsKey(e.Before.VoiceChannel))
                {
                    if (e.After.VoiceChannel != e.Before.VoiceChannel)
                        await voiceChannelLog[e.Before.VoiceChannel].SendMessage($"🎼`{e.Before.Name} has left the` {e.Before.VoiceChannel.Mention} `voice channel.`");
                }
                if (e.After.VoiceChannel != null && voiceChannelLog.ContainsKey(e.After.VoiceChannel))
                {
                    if (e.After.VoiceChannel != e.Before.VoiceChannel)
                        await voiceChannelLog[e.After.VoiceChannel].SendMessage($"🎼`{e.After.Name} has joined the`{e.After.VoiceChannel.Mention} `voice channel.`");
                }
            }
            catch { }

            try
            {
                Channel ch;
                if (!logs.TryGetValue(e.Server, out ch))
                    return;
                string str = $"`Type:` **User updated** `Time:` **{DateTime.Now}** `User:` **{e.Before.Name}**\n";
                if (e.Before.Name != e.After.Name)
                    str += $"`New name:` **{e.After.Name}**";
                else if (e.Before.AvatarUrl != e.After.AvatarUrl)
                    str += $"`New Avatar:` {e.After.AvatarUrl}";
                else
                    return;
                await ch.SendMessage(str);
            }
            catch { }
        }