public async Task StartMeetingCommand(CommandContext ctx) { CrabgileMeeting crabgileMeeting = CrabgileMeeting.GetMeetingFromHost(ctx.Member); if (crabgileMeeting is CrabgileTimebox) { ((CrabgileTimebox)crabgileMeeting).BeginTimeboxMeeting(); } await TryDeleteUserMessage(ctx); }
public async Task EndMeetingCommand(CommandContext ctx) { if (CrabgileMeeting.IsDiscordUserMeetingHost(ctx.Member)) { await CrabgileMeeting.GetMeetingFromHost(ctx.Member).CloseMeeting(); } else { await ctx.RespondAsync($"I'm afraid there's no meeting in progress, {ctx.Member.Mention}!"); } await TryDeleteUserMessage(ctx); }
public async Task TimeboxCommand(CommandContext ctx, int time) { await ctx.RespondAsync($"Creating a {time} minute timebox...\n**Type !begin to start the timebox session, {ctx.Member.Mention}.**\n*(Alternatively, you can type !end to end the meeting prematurely.)*"); if (!CrabgileMeeting.IsDiscordUserMeetingHost(ctx.Member)) { new CrabgileTimebox(ctx.Member, time); } else { await ctx.RespondAsync($"You are already hosting a meeting, {ctx.Member.Mention}!"); } await TryDeleteUserMessage(ctx); }
public async Task MeetingCommand(CommandContext ctx) { await ctx.RespondAsync($"Creating a meeting...\n**Type !end to close the meeting, {ctx.Member.Mention}.**"); if (!CrabgileMeeting.IsDiscordUserMeetingHost(ctx.Member)) { CrabgileMeeting meeting = new CrabgileMeeting(ctx.Member); meeting.AddChannelToMeeting(await ctx.Guild.CreateVoiceChannelAsync("Meeting Voice", await meeting.GetMeetingCategory())); } else { await ctx.RespondAsync($"You are already hosting a meeting, {ctx.Member.Mention}!"); } await TryDeleteUserMessage(ctx); }
static void Main(string[] args) { Console.WriteLine("Please enter the Discord bot token:"); string token = Console.ReadLine(); Console.Clear(); try { string censoredToken = token.Substring(0, 4); for (int i = 0; i < token.Length - 8; i++) { censoredToken += "."; } censoredToken += token.Substring(token.Length - 4, 4); Console.WriteLine("Crabgile Discord Bot\nToken: " + censoredToken); Task.Run(async() => { while (true) { string input = Console.ReadLine(); if (input == "exit" || input == "q") { Console.WriteLine("Closing all active meetings..."); CrabgileMeeting.CloseAllMeetings(); await CrabgileMeeting.WaitUntilMeetingsClosed(); Environment.Exit(1); return; } } }); } catch (Exception) { //String probably wasn't long enough. return; } MainDiscordBotAsync(token).GetAwaiter().GetResult(); }