Ejemplo n.º 1
0
 public InfoService(BotContext botContext, CommandService commandService, IServiceProvider serviceProvider, InteractivityService interactivityService)
 {
     _botContext           = botContext;
     _commandService       = commandService;
     _serviceProvider      = serviceProvider;
     _interactivityService = interactivityService;
 }
Ejemplo n.º 2
0
 public MessageQueue(DiscordSocketClient client, InteractivityService interactive, Logger logger, GuildSettings settings, IConfiguration config)
 {
     _client                  = client;
     _inter                   = interactive;
     _logger                  = logger;
     _settings                = settings;
     prefix                   = $"<@{config["pokeNavId"]}> ";
     options                  = RequestOptions.Default;
     options.RetryMode        = RetryMode.RetryRatelimit;
     typingOptions            = RequestOptions.Default;
     typingOptions.RetryMode  = RetryMode.AlwaysFail;
     defaultEmbed             = new EmbedBuilder();
     defaultEmbed.Title       = "Exporting...";
     defaultEmbed.Description = "This is still to do:";
     defaultEmbed.Fields.Add(new EmbedFieldBuilder()
     {
         Name = "Creations", Value = 0, IsInline = true
     });
     defaultEmbed.Fields.Add(new EmbedFieldBuilder()
     {
         Name = "Edits", Value = 0, IsInline = true
     });
     defaultEmbed.Footer = new EmbedFooterBuilder()
     {
         Text = "use pause or resume Commands to manage the export!"
     };
 }
Ejemplo n.º 3
0
        /// <inheritdoc/>
        public async Task SendAsync(InteractivityService service, IMessageChannel channel)
        {
            this.Channel = channel;
            this.Message = await DisplayAsync(channel);

            await UpdateAsync();
        }
Ejemplo n.º 4
0
 public GuildConfigCommands(InteractivityService interactivity, IGuildConfigRepository repo, ILoggingService logging, DiscordSocketClient client)
 {
     logging.Info("Initialising Guild Config Command Service");
     _interactivity = interactivity;
     _repo          = repo;
     _logging       = new SourcedLoggingService(logging, "ConfigCmds");
     _client        = client.Rest;
 }
Ejemplo n.º 5
0
 public JailConfigCommands(DiscordSocketClient client, ILoggingService logging, IJailSettingsRepository jailSettings, IGuildConfigRepository repo, InteractivityService interactivity)
 {
     _client        = client.Rest;
     _jailSettings  = jailSettings;
     _repo          = repo;
     _interactivity = interactivity;
     _logging       = new SourcedLoggingService(logging, "jailconfig");
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PaginatedEmbed"/> class.
 /// </summary>
 /// <param name="feedbackService">The feedback service.</param>
 /// <param name="interactivityService">The interactivity service.</param>
 /// <param name="sourceUser">The user who caused the interactive message to be created.</param>
 public PaginatedEmbed
 (
     UserFeedbackService feedbackService,
     InteractivityService interactivityService,
     IUser sourceUser
 )
     : base(feedbackService, interactivityService, sourceUser)
 {
 }
Ejemplo n.º 7
0
        public SetupService(InteractivityService interactivityService, BotContext botContext, DiscordSocketClient client, IServiceProvider serviceProvider)
        {
            _interactivityService = interactivityService;
            _botContext           = botContext;
            _serviceProvider      = serviceProvider;

            //Handle event when bot joins guild
            client.JoinedGuild += Client_JoinedGuild;
        }
 public ReactionRoleCommands(InteractivityService interactivity, IGuildConfigRepository repo, ILoggingService logging, DiscordSocketClient client, ReactionRoleService rrService, IReactionRoleRuleRepository rrRepo)
 {
     logging.Info("Initialising Reaction Role Command Service");
     _interactivity = interactivity;
     _repo          = repo;
     _rrService     = rrService;
     _rrRepo        = rrRepo;
     _logging       = new SourcedLoggingService(logging, "RRCmds");
     _client        = client.Rest;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PaginatedMessage{T1,T2}"/> class.
 /// </summary>
 /// <param name="feedbackService">The user feedback service.</param>
 /// <param name="interactivityService">The interactivity service.</param>
 /// <param name="sourceUser">The user who caused the interactive message to be created.</param>
 protected PaginatedMessage
 (
     UserFeedbackService feedbackService,
     InteractivityService interactivityService,
     IUser sourceUser
 )
     : base(sourceUser, interactivityService)
 {
     this.Feedback         = feedbackService;
     this.Appearance.Color = Color.DarkPurple;
 }
Ejemplo n.º 10
0
 public JailCommands(InteractivityService interactivity, IGuildConfigRepository repo, IJailSettingsRepository jailSettings, ILoggingService logging, DiscordSocketClient client, IJailDataRepository jailData, UnjailService unjail)
 {
     _interactivity = interactivity;
     _repo          = repo;
     _jailSettings  = jailSettings;
     _jailData      = jailData;
     _unjail        = unjail;
     _logging       = new SourcedLoggingService(logging, "Jail");
     _client        = client.Rest;
     _logging.Info("Jail commands setup");
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InteractivityBehaviour"/> class.
 /// </summary>
 /// <param name="client">The Discord client.</param>
 /// <param name="serviceScope">The service scope in use.</param>
 /// <param name="logger">The logging instance for this type.</param>
 /// <param name="interactivity">The interactivity service.</param>
 public InteractivityBehaviour
 (
     DiscordSocketClient client,
     IServiceScope serviceScope,
     ILogger <InteractivityBehaviour> logger,
     InteractivityService interactivity
 )
     : base(client, serviceScope, logger)
 {
     _interactivity = interactivity;
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AutoroleCommands"/> class.
 /// </summary>
 /// <param name="autoroles">The autorole service.</param>
 /// <param name="feedback">The feedback service.</param>
 /// <param name="interactivity">The interactivity service.</param>
 public AutoroleCommands
 (
     AutoroleService autoroles,
     UserFeedbackService feedback,
     InteractivityService interactivity
 )
 {
     _autoroles     = autoroles;
     _feedback      = feedback;
     _interactivity = interactivity;
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="KinkCommands"/> class.
 /// </summary>
 /// <param name="kinks">The application's kink service.</param>
 /// <param name="feedback">The application's feedback service.</param>
 /// <param name="interactivity">The interactivity service.</param>
 public KinkCommands
 (
     KinkService kinks,
     UserFeedbackService feedback,
     InteractivityService interactivity
 )
 {
     _kinks         = kinks;
     _feedback      = feedback;
     _interactivity = interactivity;
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DossierCommands"/> class.
 /// </summary>
 /// <param name="feedback">The feedback service.</param>
 /// <param name="dossiers">The dossier service.</param>
 /// <param name="interactivity">The interactivity service.</param>
 public DossierCommands
 (
     UserFeedbackService feedback,
     DossierService dossiers,
     InteractivityService interactivity
 )
 {
     _feedback      = feedback;
     _dossiers      = dossiers;
     _interactivity = interactivity;
 }
Ejemplo n.º 15
0
        public ModerationService(BotContext botContext, InteractivityService interactivityService, DiscordSocketClient client, IMemoryCache memoryCache)
        {
            _botContext           = botContext;
            _interactivityService = interactivityService;
            _banCache             = memoryCache;

            //Events
            client.UserJoined   += UserJoinedServer;
            client.UserLeft     += UserLeftServer;
            client.UserBanned   += UserBanned;
            client.UserUnbanned += UserUnbanned;
        }
Ejemplo n.º 16
0
        //Constructor
        public MusicService(LavaNode lavaNode, InteractivityService interactivityService, DiscordSocketClient client, IMemoryCache memoryCache)
        {
            _lavaNode             = lavaNode;
            _interactivityService = interactivityService;
            _memoryCache          = memoryCache;

            //Events
            _lavaNode.OnTrackEnded       += OnTrackEnded;
            _lavaNode.OnTrackException   += OnTrackException;
            _lavaNode.OnTrackStarted     += OnTrackStarted;
            client.UserVoiceStateUpdated += UserVoiceStateUpdated;
            client.Ready += Client_Ready;
        }
Ejemplo n.º 17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HelpCommands"/> class.
 /// </summary>
 /// <param name="commands">The command service.</param>
 /// <param name="feedback">The feedback service.</param>
 /// <param name="interactive">The interactive service.</param>
 /// <param name="help">The help service.</param>
 public HelpCommands
 (
     CommandService commands,
     UserFeedbackService feedback,
     InteractivityService interactive,
     HelpService help
 )
 {
     _commands    = commands;
     _feedback    = feedback;
     _interactive = interactive;
     _help        = help;
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RoleplayCommands"/> class.
 /// </summary>
 /// <param name="roleplays">The roleplay service.</param>
 /// <param name="feedback">The user feedback service.</param>
 /// <param name="interactivity">The interactivity service.</param>
 /// <param name="users">The user service.</param>
 public RoleplayCommands
 (
     RoleplayService roleplays,
     UserFeedbackService feedback,
     InteractivityService interactivity,
     UserService users
 )
 {
     _roleplays     = roleplays;
     _feedback      = feedback;
     _interactivity = interactivity;
     _users         = users;
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HelpCommands"/> class.
 /// </summary>
 /// <param name="commands">The command service.</param>
 /// <param name="feedback">The feedback service.</param>
 /// <param name="interactive">The interactive service.</param>
 /// <param name="help">The help service.</param>
 public HelpCommands
 (
     [NotNull] CommandService commands,
     [NotNull] UserFeedbackService feedback,
     [NotNull] InteractivityService interactive,
     [NotNull] HelpService help
 )
 {
     _commands    = commands;
     _feedback    = feedback;
     _interactive = interactive;
     _help        = help;
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NoteCommands"/> class.
 /// </summary>
 /// <param name="notes">The moderation service.</param>
 /// <param name="feedback">The feedback service.</param>
 /// <param name="interactivity">The interactivity service.</param>
 /// <param name="logging">The logging service.</param>
 public NoteCommands
 (
     [NotNull] NoteService notes,
     [NotNull] UserFeedbackService feedback,
     [NotNull] InteractivityService interactivity,
     [NotNull] ChannelLoggingService logging
 )
 {
     _notes         = notes;
     _feedback      = feedback;
     _interactivity = interactivity;
     _logging       = logging;
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RoleplayCommands"/> class.
 /// </summary>
 /// <param name="discordRoleplays">The roleplay service.</param>
 /// <param name="feedback">The user feedback service.</param>
 /// <param name="interactivity">The interactivity service.</param>
 /// <param name="dedicatedChannels">The dedicated channel service.</param>
 public RoleplayCommands
 (
     RoleplayDiscordService discordRoleplays,
     UserFeedbackService feedback,
     InteractivityService interactivity,
     DedicatedChannelService dedicatedChannels
 )
 {
     _discordRoleplays  = discordRoleplays;
     _feedback          = feedback;
     _interactivity     = interactivity;
     _dedicatedChannels = dedicatedChannels;
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NoteCommands"/> class.
 /// </summary>
 /// <param name="notes">The moderation service.</param>
 /// <param name="feedback">The feedback service.</param>
 /// <param name="interactivity">The interactivity service.</param>
 /// <param name="logging">The logging service.</param>
 public NoteCommands
 (
     NoteService notes,
     UserFeedbackService feedback,
     InteractivityService interactivity,
     ChannelLoggingService logging
 )
 {
     _notes         = notes;
     _feedback      = feedback;
     _interactivity = interactivity;
     _logging       = logging;
 }
Ejemplo n.º 23
0
 static DiscordService()
 {
     // Service Setup //
     provider      = ConfigureServices();
     client        = provider.GetRequiredService <DiscordSocketClient>();
     funModule     = provider.GetRequiredService <FunModule>();
     configService = provider.GetRequiredService <ConfigModule>();
     interactivity = provider.GetRequiredService <InteractivityService>();
     commands      = provider.GetRequiredService <CommandService>();
     // Discord Events //
     client.Ready += ReadyAsync;
     client.Log   += LogAsync;
 }
Ejemplo n.º 24
0
        /// <inheritdoc/>
        public async Task <OperationResult> SendAsync(InteractivityService service, IMessageChannel channel)
        {
            this.Channel = channel;
            var displayResult = await DisplayAsync(channel);

            if (!displayResult.IsSuccess)
            {
                return(OperationResult.FromError(displayResult));
            }

            this.Message = displayResult.Entity;

            return(await UpdateAsync());
        }
        /// <summary>
        /// Creates a simple paginated list from a collection of items.
        /// </summary>
        /// <param name="feedbackService">The user feedback service.</param>
        /// <param name="interactivityService">The interactivity service.</param>
        /// <param name="sourceUser">The user who caused the interactive message to be created.</param>
        /// <param name="items">The items.</param>
        /// <param name="titleSelector">A function that selects the title for each field.</param>
        /// <param name="valueSelector">A function that selects the value for each field.</param>
        /// <param name="emptyCollectionDescription">The description to use when the collection is empty.</param>
        /// <param name="appearance">The appearance settings to use for the pager.</param>
        /// <typeparam name="TItem">The type of the items in the collection.</typeparam>
        /// <returns>The paginated embed.</returns>
        public static PaginatedEmbed SimpleFieldsFromCollection <TItem>
        (
            UserFeedbackService feedbackService,
            InteractivityService interactivityService,
            IUser sourceUser,
            IEnumerable <TItem> items,
            Func <TItem, string> titleSelector,
            Func <TItem, string> valueSelector,
            string emptyCollectionDescription     = "There's nothing here.",
            PaginatedAppearanceOptions?appearance = null
        )
        {
            appearance ??= PaginatedAppearanceOptions.Default;

            var enumeratedItems = items.ToList();
            var paginatedEmbed  = new PaginatedEmbed(feedbackService, interactivityService, sourceUser)
            {
                Appearance = appearance
            };

            IEnumerable <EmbedBuilder> pages;

            if (!enumeratedItems.Any())
            {
                var eb = paginatedEmbed.Appearance.CreateEmbedBase().WithDescription(emptyCollectionDescription);
                pages = new[] { eb };
            }
            else
            {
                var fields = enumeratedItems.Select
                             (
                    i =>
                    new EmbedFieldBuilder()
                    .WithName
                    (
                        string.IsNullOrWhiteSpace(titleSelector(i)) ? "Not set" : titleSelector(i)
                    )
                    .WithValue
                    (
                        string.IsNullOrWhiteSpace(valueSelector(i)) ? "Not set" : valueSelector(i)
                    )
                             );

                pages = PageFactory.FromFields(fields);
            }

            paginatedEmbed.WithPages(pages);

            return(paginatedEmbed);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="PermissionCommands"/> class.
 /// </summary>
 /// <param name="database">A database context from the context pool.</param>
 /// <param name="feedback">The user feedback service.</param>
 /// <param name="permissions">The permission service.</param>
 /// <param name="interactivity">The interactivity service.</param>
 /// <param name="permissionRegistry">The permission registry service.</param>
 public PermissionCommands
 (
     [NotNull] PermissionsDatabaseContext database,
     [NotNull] UserFeedbackService feedback,
     [NotNull] PermissionService permissions,
     [NotNull] InteractivityService interactivity,
     [NotNull] PermissionRegistryService permissionRegistry
 )
 {
     _feedback           = feedback;
     _permissions        = permissions;
     _interactivity      = interactivity;
     _permissionRegistry = permissionRegistry;
 }
Ejemplo n.º 27
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BanCommands"/> class.
 /// </summary>
 /// <param name="moderation">The moderation service.</param>
 /// <param name="bans">The ban service.</param>
 /// <param name="feedback">The feedback service.</param>
 /// <param name="interactivity">The interactivity service.</param>
 /// <param name="logging">The logging service.</param>
 public BanCommands
 (
     [NotNull] ModerationService moderation,
     [NotNull] BanService bans,
     [NotNull] UserFeedbackService feedback,
     [NotNull] InteractivityService interactivity,
     [NotNull] ChannelLoggingService logging
 )
 {
     _moderation    = moderation;
     _bans          = bans;
     _feedback      = feedback;
     _interactivity = interactivity;
     _logging       = logging;
 }
Ejemplo n.º 28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BanCommands"/> class.
 /// </summary>
 /// <param name="moderation">The moderation service.</param>
 /// <param name="bans">The ban service.</param>
 /// <param name="feedback">The feedback service.</param>
 /// <param name="interactivity">The interactivity service.</param>
 /// <param name="logging">The logging service.</param>
 public BanCommands
 (
     ModerationService moderation,
     BanService bans,
     UserFeedbackService feedback,
     InteractivityService interactivity,
     ChannelLoggingService logging
 )
 {
     _moderation    = moderation;
     _bans          = bans;
     _feedback      = feedback;
     _interactivity = interactivity;
     _logging       = logging;
 }
Ejemplo n.º 29
0
        public static async Task <bool> WaitForBoolReplyAsync(this InteractivityExtension interactivity, CommandContext ctx)
        {
            InteractivityService ins = ctx.Services.GetRequiredService <InteractivityService>();

            ins.AddPendingResponse(ctx.Channel.Id, ctx.User.Id);

            bool response = await WaitForBoolReplyAsync(interactivity, ctx.Channel, ctx.User);

            if (!ins.RemovePendingResponse(ctx.Channel.Id, ctx.User.Id))
            {
                throw new ConcurrentOperationException("Failed to remove user from pending list");
            }

            return(response);
        }
Ejemplo n.º 30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WarningCommands"/> class.
 /// </summary>
 /// <param name="moderation">The moderation service.</param>
 /// <param name="warnings">The warning service.</param>
 /// <param name="feedback">The feedback service.</param>
 /// <param name="interactivity">The interactivity service.</param>
 /// <param name="logging">The logging service.</param>
 public WarningCommands
 (
     [NotNull] ModerationService moderation,
     [NotNull] WarningService warnings,
     [NotNull] UserFeedbackService feedback,
     [NotNull] InteractivityService interactivity,
     [NotNull] ChannelLoggingService logging
 )
 {
     _moderation    = moderation;
     _warnings      = warnings;
     _feedback      = feedback;
     _interactivity = interactivity;
     _logging       = logging;
 }