public async Task Version() { var appinf = await Context.Client.GetApplicationInfoAsync(); Assembly execas = Assembly.GetExecutingAssembly(); EmptyModuleInfo botinf = (EmptyModuleInfo)BotGearCore.GetAssemblyInfo(execas.GetName().CodeBase); string strappinfo = null, invurl = String.Format("https://discordapp.com/api/oauth2/authorize?client_id={0}&scope=bot&permissions=0", Context.Client.CurrentUser.Id); StringBuilder str = new StringBuilder(); strappinfo = String.Format("Application Name : {0} \n Version : {1} \n Description : {2}\n" + "Owner: {3} Created at : {4} \nSource Code: {5} \n Invite Url:{6}" , appinf.Name, Assembly.GetExecutingAssembly().GetName().Version.ToString(), appinf.Description, appinf.Owner, appinf.CreatedAt, botinf.SourceCode, invurl); await ReplyAsync(strappinfo); }
public async Task Install(IServiceProvider provider) { //Create Command Service, Inject it into Dependency Map //client = _map.Get<DiscordSocketClient>(); _provider = provider; client.MessageReceived += HandleCommand; client.UserJoined += UserJoined; client.UserLeft += UseLeft; client.UserUpdated += UserUpdated; client.GuildMemberUpdated += GuildMemberUpdated; if (commands == null) { commands = new CommandService(); } //_map.Add(commands); // map = _map; //await commands.AddModulesAsync(Assembly.GetExecutingAssembly()); var plugins = BotGearCore.GetAssemblies(); if (plugins != null) { foreach (var a in plugins) { await commands.AddModulesAsync(a); } } //Send user message to get handled // client.MessageReceived += HandleCommand; }
public async Task plugins() { try { string plugins = ""; List <IModuleInfo> inf = BotGearCore.GetAllModulesInfo().ToList(); if (inf != null) { StringBuilder strbld = new StringBuilder(); foreach (var i in inf) { strbld.AppendLine(String.Format("Name : {0} - {1}\nDescription : \n {2} \n Web Site : {3} \n Source Code : {4}\n", i.Name, i.Version, i.Description, i.WebSite, i.SourceCode)); } plugins = strbld.ToString(); } await ReplyAsync(plugins); } catch (Exception ex) { CommonTools.ErrorReporting(ex); } }