コード例 #1
0
 public MarkovService(IServiceProvider services)
 {
     _discord     = services.GetRequiredService <Discord.WebSocket.DiscordSocketClient>();
     _webService  = services.GetRequiredService <WebService>();
     _rand        = services.GetRequiredService <Random>();
     _markovModel = new Markov("markov.json");
 }
コード例 #2
0
        public static void SpecialIlia(ulong iliaId, ulong guildId, Discord.WebSocket.DiscordSocketClient client, EFContext db)
        {
            var ilyaxaDb = db.UserInfos.FirstOrDefault(u => u.Id == iliaId);
            Dictionary <string, string> nickData = (ilyaxaDb != null && ilyaxaDb.AdditionalInformationJSON != null) ?
                                                   JsonSerializer.Deserialize <Dictionary <string, string> >(ilyaxaDb.AdditionalInformationJSON) :
                                                   new Dictionary <string, string>();
            var ilyaxaNickName = nickData.ContainsKey("nick") ? nickData["nick"].Split('.', StringSplitOptions.RemoveEmptyEntries) : new string[1] {
                "Empty"
            };

            int    today         = (DateTime.Now - new DateTime(DateTime.Now.Year, 1, 1)).Days + 1;
            int    index         = today % ilyaxaNickName.Length;
            string new_ilya_nick = ilyaxaNickName[index];

            if (client.ConnectionState == ConnectionState.Connected)
            {
                var server = client.GetGuild(guildId);
                var user   = server.GetUser(iliaId);
                Task.Run(async() =>
                {
                    await user.ModifyAsync(x =>
                    {
                        x.Nickname = new_ilya_nick;
                    });
                });
            }
            else
            {
                client.Ready += async() =>
                {
                    var server = client.GetGuild(guildId);
                    var user   = server.GetUser(iliaId);
                    await user.ModifyAsync(x =>
                    {
                        x.Nickname = new_ilya_nick;
                    });
                };
            }
        }
コード例 #3
0
 internal SocketGuildChannel(DiscordSocketClient discord, ulong id, SocketGuild guild)
     : base(discord, id)
 {
     Guild = guild;
 }
コード例 #4
0
 internal SocketApplicationCommand(DiscordSocketClient client, ulong id)
     : base(client, id)
 {
 }
コード例 #5
0
 internal SocketCategoryChannel(DiscordSocketClient discord, ulong id, SocketGuild guild)
     : base(discord, id, guild)
 {
 }
コード例 #6
0
ファイル: SocketChannel.cs プロジェクト: COsborn2/GhandiBot
 internal SocketChannel(DiscordSocketClient discord, ulong id)
     : base(discord, id)
 {
 }
コード例 #7
0
 internal SocketUser(DiscordSocketClient discord, ulong id)
     : base(discord, id)
 {
 }
コード例 #8
0
 internal SocketUserMessage(DiscordSocketClient discord, ulong id, ISocketMessageChannel channel, SocketUser author, MessageSource source)
     : base(discord, id, channel, author, source)
 {
 }
コード例 #9
0
 private SocketGlobalUser(DiscordSocketClient discord, ulong id)
     : base(discord, id)
 {
 }
コード例 #10
0
 internal SocketGuildEvent(DiscordSocketClient client, SocketGuild guild, ulong id)
     : base(client, id)
 {
     Guild = guild;
 }
コード例 #11
0
 public CacheLinkedMessageCollection(DiscordSocketClient client)
 {
     //_client.MessageUncached += TryRemoveMessage;
 }
コード例 #12
0
 internal SocketSelfUser(DiscordSocketClient discord, SocketGlobalUser globalUser)
     : base(discord, globalUser.Id)
 {
     GlobalUser = globalUser;
 }
コード例 #13
0
 public HelloBotCommandHandler(IServiceProvider provider, Discord.WebSocket.DiscordSocketClient discord, CommandService tcommands) : base(provider, discord, tcommands)
 {
 }