public MarkovService(IServiceProvider services) { _discord = services.GetRequiredService <Discord.WebSocket.DiscordSocketClient>(); _webService = services.GetRequiredService <WebService>(); _rand = services.GetRequiredService <Random>(); _markovModel = new Markov("markov.json"); }
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; }); }; } }
internal SocketGuildChannel(DiscordSocketClient discord, ulong id, SocketGuild guild) : base(discord, id) { Guild = guild; }
internal SocketApplicationCommand(DiscordSocketClient client, ulong id) : base(client, id) { }
internal SocketCategoryChannel(DiscordSocketClient discord, ulong id, SocketGuild guild) : base(discord, id, guild) { }
internal SocketChannel(DiscordSocketClient discord, ulong id) : base(discord, id) { }
internal SocketUser(DiscordSocketClient discord, ulong id) : base(discord, id) { }
internal SocketUserMessage(DiscordSocketClient discord, ulong id, ISocketMessageChannel channel, SocketUser author, MessageSource source) : base(discord, id, channel, author, source) { }
private SocketGlobalUser(DiscordSocketClient discord, ulong id) : base(discord, id) { }
internal SocketGuildEvent(DiscordSocketClient client, SocketGuild guild, ulong id) : base(client, id) { Guild = guild; }
public CacheLinkedMessageCollection(DiscordSocketClient client) { //_client.MessageUncached += TryRemoveMessage; }
internal SocketSelfUser(DiscordSocketClient discord, SocketGlobalUser globalUser) : base(discord, globalUser.Id) { GlobalUser = globalUser; }
public HelloBotCommandHandler(IServiceProvider provider, Discord.WebSocket.DiscordSocketClient discord, CommandService tcommands) : base(provider, discord, tcommands) { }