Beispiel #1
0
        protected override async Task SetupGame(CommandContext ctx, string[] arguments)
        {
            ModuleDataSourceBase saveMe = MasterDataSingleton.Instance.GetDataSource(ctx.Channel);

            if (saveMe == null || arguments.Contains("force"))
            {
                saveMe = new GSSModuleDataSource();
                saveMe.GameRunnerID = ctx.User.Id;
                MasterDataSingleton.Instance.SetDataSourceForChannel(ctx.Channel, saveMe, false);
                await ctx.RespondAsync($"Done! Channel {Formatter.Bold(ctx.Channel.Name)} is now hosting an instance of {Formatter.Bold(_moduleIdentifier.Name)}.");
            }
            else
            {
                await ctx.RespondAsync($"Another game is already running in {Formatter.Bold(ctx.Channel.Name)}. If you want to discard that game's data and start a new game, retry your command with the \"force\" argument.");
            }
        }
Beispiel #2
0
        protected GSSModuleDataSource DataSource(CommandContext ctx)
        {
            ModuleDataSourceBase dataSource = this.ChannelData(ctx);

            if (dataSource == null)
            {
                throw new ChecksFailedException(ctx.Command, ctx, null);
            }
            else if (dataSource is GSSModuleDataSource)
            {
                return((GSSModuleDataSource)dataSource);
            }
            else
            {
                ctx.RespondAsync($"Sorry, I can't find any { Formatter.Bold(_moduleIdentifier.Name)} data for {Formatter.Bold(ctx.Channel.Name)}. This will probably throw an error.");
                throw new ChecksFailedException(ctx.Command, ctx, null);
            }
        }
Beispiel #3
0
 protected override async Task AddPlayer(CommandContext ctx, string[] arguments)
 {
     ModuleDataSourceBase dataSource = this.ChannelData(ctx);
 }