From 1ff07446c3b7f441a426a5cf73621e33571017e9 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Wed, 30 Nov 2016 16:23:54 +0100 Subject: [PATCH 1/5] updated commandlist --- docs/Commands List.md | 76 +++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/docs/Commands List.md b/docs/Commands List.md index e0097eee..716039eb 100644 --- a/docs/Commands List.md +++ b/docs/Commands List.md @@ -44,36 +44,36 @@ Command and aliases | Description | Usage `.settopic` `.st` | Sets a topic on the current channel. **Requires ManageChannels server permission.** | `.st My new topic` `.setchanlname` `.schn` | Changes the name of the current channel. **Requires ManageChannels server permission.** | `.schn NewName` `.prune` `.clr` | `.prune` removes all nadeko's messages in the last 100 messages.`.prune X` removes last X messages from the channel (up to 100)`.prune @Someone` removes all Someone's messages in the last 100 messages.`.prune @Someone X` removes last X 'Someone's' messages in the channel. | `.prune` or `.prune 5` or `.prune @Someone` or `.prune @Someone X` -`.die` | Shuts the bot down. **Bot owner only.** | `.die` -`.setname` `.newnm` | Gives the bot a new name. **Bot owner only.** | `.newnm BotName` -`.setavatar` `.setav` | Sets a new avatar image for the NadekoBot. Argument is a direct link to an image. **Bot owner only.** | `.setav http://i.imgur.com/xTG3a1I.jpg` -`.setgame` | Sets the bots game. **Bot owner only.** | `.setgame with snakes` -`.setstream` | Sets the bots stream. First argument is the twitch link, second argument is stream name. **Bot owner only.** | `.setstream TWITCHLINK Hello` -`.send` | Sends a message to someone on a different server through the bot. Separate server and channel/user ids with `|` and prepend channel id with `c:` and user id with `u:`. **Bot owner only.** | `.send serverid|c:channelid message` or `.send serverid|u:userid message` -`.announce` | Sends a message to all servers' general channel bot is connected to. **Bot owner only.** | `.announce Useless spam` -`.savechat` | Saves a number of messages to a text file and sends it to you. **Bot owner only.** | `.savechat 150` +`.die` | Shuts the bot down. **Bot Owner only.** | `.die` +`.setname` `.newnm` | Gives the bot a new name. **Bot Owner only.** | `.newnm BotName` +`.setavatar` `.setav` | Sets a new avatar image for the NadekoBot. Argument is a direct link to an image. **Bot Owner only.** | `.setav http://i.imgur.com/xTG3a1I.jpg` +`.setgame` | Sets the bots game. **Bot Owner only.** | `.setgame with snakes` +`.setstream` | Sets the bots stream. First argument is the twitch link, second argument is stream name. **Bot Owner only.** | `.setstream TWITCHLINK Hello` +`.send` | Sends a message to someone on a different server through the bot. Separate server and channel/user ids with `|` and prepend channel id with `c:` and user id with `u:`. **Bot Owner only.** | `.send serverid|c:channelid message` or `.send serverid|u:userid message` +`.announce` | Sends a message to all servers' general channel bot is connected to. **Bot Owner only.** | `.announce Useless spam` +`.savechat` | Saves a number of messages to a text file and sends it to you. **Bot Owner only.** | `.savechat 150` `.mentionrole` `.menro` | Mentions every person from the provided role or roles (separated by a ',') on this server. Requires you to have mention everyone permission. **Requires MentionEveryone server permission.** | `.menro RoleName` `.donators` | List of lovely people who donated to keep this project alive. | `.donators` -`.donadd` | Add a donator to the database. **Bot owner only.** | `.donadd Donate Amount` +`.donadd` | Add a donator to the database. **Bot Owner only.** | `.donadd Donate Amount` `.antiraid` | Sets an anti-raid protection on the server. First argument is number of people which will trigger the protection. Second one is a time interval in which that number of people needs to join in order to trigger the protection, and third argument is punishment for those people (Kick, Ban, Mute) **Requires Administrator server permission.** | `.antiraid 5 20 Kick` `.antispam` | Stops people from repeating same message X times in a row. You can specify to either mute, kick or ban the offenders. **Requires Administrator server permission.** | `.antispam 3 Mute` or `.antispam 4 Kick` or `.antispam 6 Ban` `.autoassignrole` `.aar` | Automaticaly assigns a specified role to every user who joins the server. **Requires ManageRoles server permission.** | `.aar` to disable, `.aar Role Name` to enable -`.scsc` | Starts an instance of cross server channel. You will get a token as a DM that other people will use to tune in to the same instance. **Bot owner only.** | `.scsc` +`.scsc` | Starts an instance of cross server channel. You will get a token as a DM that other people will use to tune in to the same instance. **Bot Owner only.** | `.scsc` `.jcsc` | Joins current channel to an instance of cross server channel using the token. **Requires ManageServer server permission.** | `.jcsc TokenHere` `.lcsc` | Leaves Cross server channel instance from this channel. **Requires ManageServer server permission.** | `.lcsc` -`.fwmsgs` | Toggles forwarding of non-command messages sent to bot's DM to the bot owners **Bot owner only.** | `.fwmsgs` -`.fwtoall` | Toggles whether messages will be forwarded to all bot owners or only to the first one specified in the credentials.json **Bot owner only.** | `.fwtoall` -`.logserver` | Logs server activity in this channel. **Requires Administrator server permission.** **Bot owner only.** | `.logserver` -`.logignore` | Toggles whether the .logserver command ignores this channel. Useful if you have hidden admin channel and public log channel. **Requires Administrator server permission.** **Bot owner only.** | `.logignore` +`.fwmsgs` | Toggles forwarding of non-command messages sent to bot's DM to the bot owners **Bot Owner only.** | `.fwmsgs` +`.fwtoall` | Toggles whether messages will be forwarded to all bot owners or only to the first one specified in the credentials.json **Bot Owner only.** | `.fwtoall` +`.logserver` | Logs server activity in this channel. **Requires Administrator server permission.** **Bot Owner only.** | `.logserver` +`.logignore` | Toggles whether the .logserver command ignores this channel. Useful if you have hidden admin channel and public log channel. **Requires Administrator server permission.** **Bot Owner only.** | `.logignore` `.userpresence` | Starts logging to this channel when someone from the server goes online/offline/idle. **Requires Administrator server permission.** | `.userpresence` `.voicepresence` | Toggles logging to this channel whenever someone joins or leaves a voice channel you are currently in. **Requires Administrator server permission.** | `.voicepresence` `.repeatinvoke` `.repinv` | Immediately shows the repeat message and restarts the timer. **Requires ManageMessages server permission.** | `.repinv` -`.repeat` | Repeat a message every X minutes. If no parameters are specified, repeat is disabled. | `.repeat 5 Hello there` -`.migratedata` | Migrate data from old bot configuration **Bot owner only.** | `.migratedata` -`.rotateplaying` `.ropl` | Toggles rotation of playing status of the dynamic strings you previously specified. **Bot owner only.** | `.ropl` -`.addplaying` `.adpl` | Adds a specified string to the list of playing strings to rotate. Supported placeholders: %servers%, %users%, %playing%, %queued% **Bot owner only.** | `.adpl` -`.listplaying` `.lipl` | Lists all playing statuses with their corresponding number. **Bot owner only.** | `.lipl` -`.removeplaying` `.rmpl` `.repl` | Removes a playing string on a given number. **Bot owner only.** | `.rmpl` +`.repeat` | Repeat a message every X minutes. If no parameters are specified, repeat is disabled. **Requires ManageMessages server permission.** | `.repeat 5 Hello there` +`.migratedata` | Migrate data from old bot configuration **Bot Owner only.** | `.migratedata` +`.rotateplaying` `.ropl` | Toggles rotation of playing status of the dynamic strings you previously specified. **Bot Owner only.** | `.ropl` +`.addplaying` `.adpl` | Adds a specified string to the list of playing strings to rotate. Supported placeholders: %servers%, %users%, %playing%, %queued% **Bot Owner only.** | `.adpl` +`.listplaying` `.lipl` | Lists all playing statuses with their corresponding number. **Bot Owner only.** | `.lipl` +`.removeplaying` `.rmpl` `.repl` | Removes a playing string on a given number. **Bot Owner only.** | `.rmpl` `.slowmode` | Toggles slowmode. Disable by specifying no parameters. To enable, specify a number of messages each user can send, and an interval in seconds. For example 1 message every 5 seconds. **Requires ManageMessages server permission.** | `.slowmode 1 5` or `.slowmode` `.adsarm` | Toggles the automatic deletion of confirmations for .iam and .iamn commands. **Requires ManageMessages server permission.** | `.adsarm` `.asar` | Adds a role to the list of self-assignable roles. **Requires ManageRoles server permission.** | `.asar Gamer` @@ -82,15 +82,15 @@ Command and aliases | Description | Usage `.togglexclsar` `.tesar` | Toggles whether the self-assigned roles are exclusive. (So that any person can have only one of the self assignable roles) **Requires ManageRoles server permission.** | `.tesar` `.iam` | Adds a role to you that you choose. Role must be on a list of self-assignable roles. | `.iam Gamer` `.iamnot` `.iamn` | Removes a role to you that you choose. Role must be on a list of self-assignable roles. | `.iamn Gamer` -`.leave` | Makes Nadeko leave the server. Either name or id required. **Bot owner only.** | `.leave 123123123331` -`.greetdel` `.grdel` | Toggles automatic deletion of greet messages. **Requires ManageServer server permission.** | `.greetdel` +`.leave` | Makes Nadeko leave the server. Either name or id required. **Bot Owner only.** | `.leave 123123123331` +`.greetdel` `.grdel` | Sets the time it takes (in seconds) for greet messages to be auto-deleted. Set 0 to disable automatic deletion. **Requires ManageServer server permission.** | `.greetdel 0` or `.greetdel 30` `.greet` | Toggles anouncements on the current channel when someone joins the server. **Requires ManageServer server permission.** | `.greet` `.greetmsg` | Sets a new join announcement message which will be shown in the server's channel. Type %user% if you want to mention the new member. Using it with no message will show the current greet message. **Requires ManageServer server permission.** | `.greetmsg Welcome, %user%.` `.greetdm` | Toggles whether the greet messages will be sent in a DM (This is separate from greet - you can have both, any or neither enabled). **Requires ManageServer server permission.** | `.greetdm` `.greetdmmsg` | Sets a new join announcement message which will be sent to the user who joined. Type %user% if you want to mention the new member. Using it with no message will show the current DM greet message. **Requires ManageServer server permission.** | `.greetdmmsg Welcome to the server, %user%`. `.bye` | Toggles anouncements on the current channel when someone leaves the server. **Requires ManageServer server permission.** | `.bye` `.byemsg` | Sets a new leave announcement message. Type %user% if you want to mention the new member. Using it with no message will show the current bye message. **Requires ManageServer server permission.** | `.byemsg %user% has left.` -`.byedel` | Toggles automatic deletion of bye messages. **Requires ManageServer server permission.** | `.byedel` +`.byedel` | Sets the time it takes (in seconds) for bye messages to be auto-deleted. Set 0 to disable automatic deletion. **Requires ManageServer server permission.** | `.byedel 0` or `.byedel 30` `.voice+text` `.v+t` | Creates a text channel for each voice channel only users in that voice channel can see.If you are server owner, keep in mind you will see them all the time regardless. **Requires ManageRoles server permission.** **Requires ManageChannels server permission.** | `.voice+text` `.cleanvplust` `.cv+t` | Deletes all text channels ending in `-voice` for which voicechannels are not found. Use at your own risk. **Requires ManageChannels server permission.** **Requires ManageRoles server permission.** | `.cleanv+t` @@ -114,7 +114,7 @@ Command and aliases | Description | Usage ### CustomReactions Command and aliases | Description | Usage ----------------|--------------|------- -`.addcustreact` `.acr` | Add a custom reaction with a trigger and a response. Running this command in server requires Administration permission. Running this command in DM is Bot Owner only and adds a new global custom reaction. Guide here: | `.acr "hello" Hi there %user%` +`.addcustreact` `.acr` | Add a custom reaction with a trigger and a response. Running this command in server requires Administration permission. Running this command in DM is Bot Owner only and adds a new global custom reaction. Guide here: | `.acr "hello" Hi there %user%` `.listcustreact` `.lcr` | Lists global or server custom reactions (20 commands per page). Running the command in DM will list global custom reactions, while running it in server will list that server's custom reactions. Specifying `all` argument instead of the number will DM you a text file with a list of all custom reactions. | `.lcr 1` or `.lcr all` `.listcustreactg` `.lcrg` | Lists global or server custom reactions (20 commands per page) grouped by trigger, and show a number of responses for each. Running the command in DM will list global custom reactions, while running it in server will list that server's custom reactions. | `.lcrg 1` `.showcustreact` `.scr` | Shows a custom reaction's response on a given ID. | `.scr 1` @@ -128,8 +128,8 @@ Command and aliases | Description | Usage `$raffle` | Prints a name and ID of a random user from the online list from the (optional) role. | `$raffle` or `$raffle RoleName` `$cash` `$$$` | Check how much currency a person has. (Defaults to yourself) | `$$$` or `$$$ @SomeGuy` `$give` | Give someone a certain amount of currency. | `$give 1 "@SomeGuy"` -`$award` | Awards someone a certain amount of currency. You can also specify a role name to award currency to all users in a role. **Bot owner only.** | `$award 100 @person` or `$award 5 Role Of Gamblers` -`$take` | Takes a certain amount of currency from someone. **Bot owner only.** | `$take 1 "@someguy"` +`$award` | Awards someone a certain amount of currency. You can also specify a role name to award currency to all users in a role. **Bot Owner only.** | `$award 100 @person` or `$award 5 Role Of Gamblers` +`$take` | Takes a certain amount of currency from someone. **Bot Owner only.** | `$take 1 "@someguy"` `$betroll` `$br` | Bets a certain amount of currency and rolls a dice. Rolling over 66 yields x2 of your currency, over 90 - x3 and 100 x10. | `$br 5` `$leaderboard` `$lb` | Displays bot currency leaderboard. | `$lb` `$race` | Starts a new animal race. | `$race` @@ -161,9 +161,9 @@ Command and aliases | Description | Usage `>gencurrency` `>gc` | Toggles currency generation on this channel. Every posted message will have chance to spawn currency. Chance is specified by the Bot Owner. (default is 2%) **Requires ManageMessages server permission.** | `>gc` `>typestart` | Starts a typing contest. | `>typestart` `>typestop` | Stops a typing contest on the current channel. | `>typestop` -`>typeadd` | Adds a new article to the typing contest. **Bot owner only.** | `>typeadd wordswords` +`>typeadd` | Adds a new article to the typing contest. **Bot Owner only.** | `>typeadd wordswords` `>typelist` | Lists added typing articles with their IDs. 15 per page. | `>typelist` or `>typelist 3` -`>typedel` | Deletes a typing article given the ID. **Bot owner only.** | `>typedel 3` +`>typedel` | Deletes a typing article given the ID. **Bot Owner only.** | `>typedel 3` `>trivia` `>t` | Starts a game of trivia. You can add nohint to prevent hints.First player to get to 10 points wins by default. You can specify a different number. 30 seconds per question. | `>t` or `>t 5 nohint` `>tl` | Shows a current trivia leaderboard. | `>tl` `>tq` | Quits current trivia after current question. | `>tq` @@ -176,7 +176,7 @@ Command and aliases | Description | Usage `-modules` `-mdls` | Lists all bot modules. | `-modules` `-commands` `-cmds` | List all of the bot's commands from a certain module. You can either specify full, or only first few letters of the module name. | `-commands Administration` or `-cmds Admin` `-help` `-h` | Either shows a help for a single command, or DMs you help link if no arguments are specified. | `-h !!q` or `-h` -`-hgit` | Generates the commandlist.md file. **Bot owner only.** | `-hgit` +`-hgit` | Generates the commandlist.md file. **Bot Owner only.** | `-hgit` `-readme` `-guide` | Sends a readme and a guide links to the channel. | `-readme` or `-guide` `-donate` | Instructions for helping the project financially. | `-donate` @@ -198,9 +198,9 @@ Command and aliases | Description | Usage `!!shuffle` `!!sh` | Shuffles the current playlist. | `!!sh` `!!playlist` `!!pl` | Queues up to 500 songs from a youtube playlist specified by a link, or keywords. | `!!pl playlist link or name` `!!soundcloudpl` `!!scpl` | Queue a soundcloud playlist using a link. | `!!scpl soundcloudseturl` -`!!localplaylst` `!!lopl` | Queues all songs from a directory. **Bot owner only.** | `!!lopl C:/music/classical` +`!!localplaylst` `!!lopl` | Queues all songs from a directory. **Bot Owner only.** | `!!lopl C:/music/classical` `!!radio` `!!ra` | Queues a radio stream from a link. It can be a direct mp3 radio stream, .m3u, .pls .asx or .xspf (Usage Video: ) | `!!ra radio link here` -`!!local` `!!lo` | Queues a local file by specifying a full path. **Bot owner only.** | `!!lo C:/music/mysong.mp3` +`!!local` `!!lo` | Queues a local file by specifying a full path. **Bot Owner only.** | `!!lo C:/music/mysong.mp3` `!!move` `!!mv` | Moves the bot to your voice channel. (works only if music is already playing) | `!!mv` `!!remove` `!!rm` | Remove a song by its # in the queue, or 'all' to remove whole queue. | `!!rm 5` `!!movesong` `!!ms` | Moves a song from one position to another. | `!!ms 5>3` @@ -222,7 +222,6 @@ Command and aliases | Description | Usage ----------------|--------------|------- `~hentai` | Shows a hentai image from a random website (gelbooru or danbooru or konachan or atfbooru or yandere) with a given tag. Tag is optional but preferred. Only 1 tag allowed. | `~hentai yuri` `~hentaibomb` | Shows a total 5 images (from gelbooru, danbooru, konachan, yandere and atfbooru). Tag is optional but preferred. | `~hentaibomb yuri` -`~atfbooru` `~atf` | Shows a random hentai image from atfbooru with a given tag. Tag is optional but preferred. | `~atfbooru yuri+kissing` `~yandere` | Shows a random image from yandere with a given tag. Tag is optional but preferred. (multiple tags are appended with +) | `~yandere tag1+tag2` `~danbooru` | Shows a random hentai image from danbooru with a given tag. Tag is optional but preferred. (multiple tags are appended with +) | `~danbooru yuri+kissing` `~konachan` | Shows a random hentai image from konachan with a given tag. Tag is optional but preferred. | `~konachan yuri` @@ -255,9 +254,9 @@ Command and aliases | Description | Usage `;allrolemdls` `;arm` | Enable or disable all modules for a specific role. | `;arm [enable/disable] MyRole` `;allusrmdls` `;aum` | Enable or disable all modules for a specific user. | `;aum enable @someone` `;allsrvrmdls` `;asm` | Enable or disable all modules for your server. | `;asm [enable/disable]` -`;ubl` | Either [add]s or [rem]oves a user specified by a mention or ID from a blacklist. **Bot owner only.** | `;ubl add @SomeUser` or `;ubl rem 12312312313` -`;cbl` | Either [add]s or [rem]oves a channel specified by an ID from a blacklist. **Bot owner only.** | `;cbl rem 12312312312` -`;sbl` | Either [add]s or [rem]oves a server specified by a Name or ID from a blacklist. **Bot owner only.** | `;sbl add 12312321312` or `;sbl rem SomeTrashServer` +`;ubl` | Either [add]s or [rem]oves a user specified by a mention or ID from a blacklist. **Bot Owner only.** | `;ubl add @SomeUser` or `;ubl rem 12312312313` +`;cbl` | Either [add]s or [rem]oves a channel specified by an ID from a blacklist. **Bot Owner only.** | `;cbl rem 12312312312` +`;sbl` | Either [add]s or [rem]oves a server specified by a Name or ID from a blacklist. **Bot Owner only.** | `;sbl add 12312321312` or `;sbl rem SomeTrashServer` `;cmdcooldown` `;cmdcd` | Sets a cooldown per user for a command. Set to 0 to remove the cooldown. | `;cmdcd "some cmd" 5` `;allcmdcooldowns` `;acmdcds` | Shows a list of all commands and their respective cooldowns. | `;acmdcds` `;srvrfilterinv` `;sfi` | Toggles automatic deleting of invites posted in the server. Does not affect Bot Owner. | `;sfi` @@ -282,6 +281,7 @@ Command and aliases | Description | Usage `~lmgtfy` | Google something for an idiot. | `~lmgtfy query` `~shorten` | Attempts to shorten an URL, if it fails, returns the input URL. | `~shorten https://google.com` `~google` `~g` | Get a google search link for some terms. | `~google query` +`~magicthegathering` `~mtg` | Searches for a Magic The Gathering card. | `~magicthegathering about face` or `~mtg about face` `~hearthstone` `~hs` | Searches for a Hearthstone card and shows its image. Takes a while to complete. | `~hs Ysera` `~urbandict` `~ud` | Searches Urban Dictionary for a word. | `~ud Pineapple` `~#` | Searches Tagdef.com for a hashtag. | `~# ff` @@ -322,7 +322,7 @@ Command and aliases | Description | Usage `~removestream` `~rms` | Removes notifications of a certain streamer on this channel. **Requires ManageMessages server permission.** | `~rms SomeGuy` `~checkstream` `~cs` | Checks if a user is online on a certain streaming platform. | `~cs twitch MyFavStreamer` `~translate` `~trans` | Translates from>to text. From the given language to the destination language. | `~trans en>fr Hello` -`~autotrans` `~at` | Starts automatic translation of all messages by users who set their `~atl` in this channel. You can set "del" argument to automatically delete all translated user messages. **Requires Administrator server permission.** **Bot owner only.** | `~at` or `~at del` +`~autotrans` `~at` | Starts automatic translation of all messages by users who set their `~atl` in this channel. You can set "del" argument to automatically delete all translated user messages. **Requires Administrator server permission.** **Bot Owner only.** | `~at` or `~at del` `~autotranslang` `~atl` | `~atl en>fr` | Sets your source and target language to be used with `~at`. Specify no arguments to remove previously set value. `~translangs` | Lists the valid languages for translation. | `~translangs` `~xkcd` | Shows a XKCD comic. No arguments will retrieve random one. Number argument will retrieve a specific comic, and "latest" will get the latest one. | `~xkcd` or `~xkcd 1400` or `~xkcd latest` @@ -342,7 +342,7 @@ Command and aliases | Description | Usage `.channeltopic` `.ct` | Sends current channel's topic as a message. | `.ct` `.stats` | Shows some basic stats for Nadeko. | `.stats` `.showemojis` `.se` | Shows a name and a link to every SPECIAL emoji in the message. | `.se A message full of SPECIAL emojis` -`.listservers` | Lists servers the bot is on with some basic info. 15 per page. **Bot owner only.** | `.listservers 3` +`.listservers` | Lists servers the bot is on with some basic info. 15 per page. **Bot Owner only.** | `.listservers 3` `.calculate` `.calc` | Evaluate a mathematical expression. | `.calc 1+1` `.calcops` | Shows all available operations in .calc command | `.calcops` `.togethertube` `.totube` | Creates a new room on and shows the link in the chat. | `.totube` @@ -355,6 +355,6 @@ Command and aliases | Description | Usage `.deletequote` `.delq` | Deletes a random quote with the specified keyword. You have to either be server Administrator or the creator of the quote to delete it. | `.delq abc` `.delallq` `.daq` | Deletes all quotes on a specified keyword. **Requires Administrator server permission.** | `.delallq kek` `.remind` | Sends a message to you or a channel after certain amount of time. First argument is me/here/'channelname'. Second argument is time in a descending order (mo>w>d>h>m) example: 1w5d3h10m. Third argument is a (multiword)message. | `.remind me 1d5h Do something` or `.remind #general Start now!` -`.remindtemplate` | Sets message for when the remind is triggered. Available placeholders are %user% - user who ran the command, %message% - Message specified in the remind, %target% - target channel of the remind. **Bot owner only.** | `.remindtemplate %user%, do %message%!` +`.remindtemplate` | Sets message for when the remind is triggered. Available placeholders are %user% - user who ran the command, %message% - Message specified in the remind, %target% - target channel of the remind. **Bot Owner only.** | `.remindtemplate %user%, do %message%!` `.convertlist` | List of the convertible dimensions and currencies. | `.convertlist` `.convert` | Convert quantities. Use `.convertlist` to see supported dimensions and currencies. | `.convert m km 1000` From 477a34a6eeca228f2a5ca908954861b8103dd541 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Wed, 30 Nov 2016 20:15:22 +0100 Subject: [PATCH 2/5] .stats much prettier, .SendErrorAsync added for normalized error messages --- docs/Commands List.md | 4 +- .../Modules/Administration/Administration.cs | 5 +- src/NadekoBot/Modules/Help/Help.cs | 3 +- src/NadekoBot/Modules/Utility/Utility.cs | 69 ++++++++++++++++++- src/NadekoBot/Services/Impl/StatsService.cs | 37 ++++++---- src/NadekoBot/_Extensions/Extensions.cs | 3 + 6 files changed, 98 insertions(+), 23 deletions(-) diff --git a/docs/Commands List.md b/docs/Commands List.md index 716039eb..3b38e04f 100644 --- a/docs/Commands List.md +++ b/docs/Commands List.md @@ -1,5 +1,5 @@ -For more information and how to setup your own NadekoBot, go to: -You can support the project on patreon: or paypal: `nadekodiscordbot@gmail.com` +You can support the project on patreon: or paypal: + ##Table Of Contents - [Help](#help) - [Administration](#administration) diff --git a/src/NadekoBot/Modules/Administration/Administration.cs b/src/NadekoBot/Modules/Administration/Administration.cs index 42e025a0..b137c279 100644 --- a/src/NadekoBot/Modules/Administration/Administration.cs +++ b/src/NadekoBot/Modules/Administration/Administration.cs @@ -640,8 +640,9 @@ namespace NadekoBot.Modules.Administration var channel = (ITextChannel)umsg.Channel; var user = channel.Guild.GetCurrentUser(); - - var enumerable = (await umsg.Channel.GetMessagesAsync()).Where(x => x.Author.Id == user.Id); + + var enumerable = (await umsg.Channel.GetMessagesAsync()).AsEnumerable(); + enumerable = enumerable.Where(x => x.Author.Id == user.Id); await umsg.Channel.DeleteMessagesAsync(enumerable); } diff --git a/src/NadekoBot/Modules/Help/Help.cs b/src/NadekoBot/Modules/Help/Help.cs index 11dd9437..b0e1338b 100644 --- a/src/NadekoBot/Modules/Help/Help.cs +++ b/src/NadekoBot/Modules/Help/Help.cs @@ -121,8 +121,7 @@ namespace NadekoBot.Modules.Help public Task Hgit(IUserMessage umsg) { var helpstr = new StringBuilder(); - helpstr.AppendLine(@"For more information and how to setup your own NadekoBot, go to: -You can support the project on patreon: or paypal: `nadekodiscordbot@gmail.com`"); + helpstr.AppendLine("You can support the project on patreon: or paypal: \n"); helpstr.AppendLine("##Table Of Contents"); helpstr.AppendLine(string.Join("\n", NadekoBot.CommandService.Modules.Where(m => m.Name.ToLowerInvariant() != "help").OrderBy(m => m.Name).Prepend(NadekoBot.CommandService.Modules.FirstOrDefault(m=>m.Name.ToLowerInvariant()=="help")).Select(m => $"- [{m.Name}](#{m.Name.ToLowerInvariant()})"))); helpstr.AppendLine(); diff --git a/src/NadekoBot/Modules/Utility/Utility.cs b/src/NadekoBot/Modules/Utility/Utility.cs index 3e191577..4e0dddf0 100644 --- a/src/NadekoBot/Modules/Utility/Utility.cs +++ b/src/NadekoBot/Modules/Utility/Utility.cs @@ -10,6 +10,11 @@ using NadekoBot.Extensions; using System.Text.RegularExpressions; using System.Reflection; using Discord.WebSocket; +using NadekoBot.Services.Impl; +using Discord.API; +using Embed = Discord.API.Embed; +using EmbedAuthor = Discord.API.EmbedAuthor; +using EmbedField = Discord.API.EmbedField; namespace NadekoBot.Modules.Utility { @@ -37,7 +42,7 @@ namespace NadekoBot.Modules.Utility int i = 0; if (!arr.Any()) - await channel.SendMessageAsync(_l["🚧 `Nobody is playing that game.`"]).ConfigureAwait(false); + await channel.SendErrorAsync("Nobody is playing that game.").ConfigureAwait(false); else await channel.SendMessageAsync("```css\n" + string.Join("\n", arr.GroupBy(item => (i++) / 3).Select(ig => string.Concat(ig.Select(el => $"• {el,-35}")))) + "\n```").ConfigureAwait(false); } @@ -158,7 +163,67 @@ namespace NadekoBot.Modules.Utility { var channel = umsg.Channel; - await channel.SendMessageAsync(await NadekoBot.Stats.Print()); + var stats = NadekoBot.Stats; + + await channel.EmbedAsync( + new Embed() + { + Author = new EmbedAuthor() + { + Name = $"NadekoBot v{StatsService.BotVersion}", + Url = "http://nadekobot.readthedocs.io/en/latest/", + IconUrl = "https://cdn.discordapp.com/avatars/116275390695079945/b21045e778ef21c96d175400e779f0fb.jpg" + }, + Fields = new[] { + new EmbedField() { + Name = "Author", + Value = stats.Author, + Inline = true + }, + new EmbedField() { + Name = "Library", + Value = stats.Library, + Inline = true + }, + new EmbedField() { + Name = "Bot ID", + Value = NadekoBot.Client.GetCurrentUser().Id.ToString(), + Inline = true + }, + new EmbedField() { + Name = "Commands Ran", + Value = stats.CommandsRan.ToString(), + Inline = true + }, + new EmbedField() { + Name = "Messages", + Value = $"{stats.MessageCounter} [{stats.MessagesPerSecond:F2}/sec]", + Inline = true + }, + new EmbedField() { + Name = "Memory", + Value = $"{stats.Heap} MB", + Inline = true + }, + new EmbedField() { + Name = "Owner ID(s)", + Value = stats.OwnerIds, + Inline = true + }, + new EmbedField() { + Name = "Uptime", + Value = stats.GetUptimeString("\n"), + Inline = true + }, + new EmbedField() { + Name = "Presence", + Value = $"{NadekoBot.Client.GetGuilds().Count} servers\n{stats.TextChannels} Text Channels\n{stats.VoiceChannels} Voice Channels", + Inline = true + }, + + }, + Color = NadekoBot.OkColor + }); } private Regex emojiFinder { get; } = new Regex(@"<:(?.+?):(?\d*)>", RegexOptions.Compiled); diff --git a/src/NadekoBot/Services/Impl/StatsService.cs b/src/NadekoBot/Services/Impl/StatsService.cs index 1c1cb367..e0916306 100644 --- a/src/NadekoBot/Services/Impl/StatsService.cs +++ b/src/NadekoBot/Services/Impl/StatsService.cs @@ -12,26 +12,33 @@ namespace NadekoBot.Services.Impl { public class StatsService : IStatsService { - private int messageCounter; - private ShardedDiscordClient client; + private ShardedDiscordClient client; private DateTime started; - private int commandsRan = 0; public const string BotVersion = "1.0-rc2"; + public string Author => "Kwoth#2560"; + public string Library => "Discord.Net"; + public int MessageCounter { get; private set; } = 0; + public int CommandsRan { get; private set; } = 0; public string Heap => Math.Round((double)GC.GetTotalMemory(false) / 1.MiB(), 2).ToString(); + public double MessagesPerSecond => MessageCounter / (double)GetUptime().TotalSeconds; + public int TextChannels => client.GetGuilds().SelectMany(g => g.GetChannels().Where(c => c is ITextChannel)).Count(); + public int VoiceChannels => client.GetGuilds().SelectMany(g => g.GetChannels().Where(c => c is IVoiceChannel)).Count(); + public string OwnerIds => string.Join(", ", NadekoBot.Credentials.OwnerIds); + + Timer carbonitexTimer { get; } - public StatsService(ShardedDiscordClient client, CommandHandler cmdHandler) { this.client = client; Reset(); - this.client.MessageReceived += _ => Task.FromResult(messageCounter++); - cmdHandler.CommandExecuted += (_, e) => commandsRan++; + this.client.MessageReceived += _ => Task.FromResult(MessageCounter++); + cmdHandler.CommandExecuted += (_, e) => CommandsRan++; this.client.Disconnected += _ => Reset(); @@ -61,20 +68,20 @@ namespace NadekoBot.Services.Impl public async Task Print() { var curUser = await client.GetCurrentUserAsync(); - return $@"```css -Author: [Kwoth#2560] | Library: [Discord.Net] + return $@" +Author: [{Author}] | Library: [{Library}] Bot Version: [{BotVersion}] Bot ID: {curUser.Id} -Owner ID(s): {string.Join(", ", NadekoBot.Credentials.OwnerIds)} +Owner ID(s): {OwnerIds} Uptime: {GetUptimeString()} -Servers: {client.GetGuilds().Count} | TextChannels: {client.GetGuilds().SelectMany(g => g.GetChannels().Where(c => c is ITextChannel)).Count()} | VoiceChannels: {client.GetGuilds().SelectMany(g => g.GetChannels().Where(c => c is IVoiceChannel)).Count()} -Commands Ran this session: {commandsRan} -Messages: {messageCounter} [{messageCounter / (double)GetUptime().TotalSeconds:F2}/sec] Heap: [{Heap} MB]```"; +Servers: {client.GetGuilds().Count} | TextChannels: {TextChannels} | VoiceChannels: {VoiceChannels} +Commands Ran this session: {CommandsRan} +Messages: {MessageCounter} [{MessagesPerSecond:F2}/sec] Heap: [{Heap} MB]"; } public Task Reset() { - messageCounter = 0; + MessageCounter = 0; started = DateTime.Now; return Task.CompletedTask; } @@ -82,10 +89,10 @@ Messages: {messageCounter} [{messageCounter / (double)GetUptime().TotalSeconds:F public TimeSpan GetUptime() => DateTime.Now - started; - public string GetUptimeString() + public string GetUptimeString(string separator = ", ") { var time = GetUptime(); - return time.Days + " days, " + time.Hours + " hours, and " + time.Minutes + " minutes."; + return $"{time.Days} days{separator}{time.Hours} hours{separator}{time.Minutes} minutes"; } } } diff --git a/src/NadekoBot/_Extensions/Extensions.cs b/src/NadekoBot/_Extensions/Extensions.cs index dc330324..0859d080 100644 --- a/src/NadekoBot/_Extensions/Extensions.cs +++ b/src/NadekoBot/_Extensions/Extensions.cs @@ -159,6 +159,9 @@ namespace NadekoBot.Extensions public static Task EmbedAsync(this IMessageChannel ch, Discord.API.Embed embed) => ch.SendMessageAsync("", embed: embed); + public static Task SendErrorAsync(this IMessageChannel ch, string error, string title = null, string url = null) + => ch.SendMessageAsync("", embed: new Embed() { Description = error, Title = title, Url = url, Color = NadekoBot.ErrorColor }); + public static Task SendTableAsync(this IMessageChannel ch, string seed, IEnumerable items, Func howToPrint, int columns = 3) { var i = 0; From 38c2dd366731510c6f93d6ced304977ab0d3e008 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Wed, 30 Nov 2016 20:34:31 +0100 Subject: [PATCH 3/5] Cleverbot fixed --- src/NadekoBot/Services/CleverBotApi/ChatterBotFactory.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NadekoBot/Services/CleverBotApi/ChatterBotFactory.cs b/src/NadekoBot/Services/CleverBotApi/ChatterBotFactory.cs index 642b2a23..36589fe6 100644 --- a/src/NadekoBot/Services/CleverBotApi/ChatterBotFactory.cs +++ b/src/NadekoBot/Services/CleverBotApi/ChatterBotFactory.cs @@ -32,7 +32,7 @@ namespace Services.CleverBotApi switch (type) { case ChatterBotType.CLEVERBOT: - return new Cleverbot("http://www.cleverbot.com/", "http://www.cleverbot.com/webservicemin?uc=165", 26); + return new Cleverbot("http://www.cleverbot.com/", "http://www.cleverbot.com/webservicemin?uc=321", 26); case ChatterBotType.JABBERWACKY: return new Cleverbot("http://jabberwacky.com", "http://jabberwacky.com/webservicemin", 20); case ChatterBotType.PANDORABOTS: From 737fb09124995ce493cf9ffc70193e82adc343f4 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Thu, 1 Dec 2016 00:44:36 +0100 Subject: [PATCH 4/5] Fixed .greetdmmessage --- .../Modules/Administration/Commands/ServerGreetCommands.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/NadekoBot/Modules/Administration/Commands/ServerGreetCommands.cs b/src/NadekoBot/Modules/Administration/Commands/ServerGreetCommands.cs index 38e207c4..9cd57875 100644 --- a/src/NadekoBot/Modules/Administration/Commands/ServerGreetCommands.cs +++ b/src/NadekoBot/Modules/Administration/Commands/ServerGreetCommands.cs @@ -270,7 +270,7 @@ namespace NadekoBot.Modules.Administration { config = uow.GuildConfigs.For(channel.Guild.Id); } - await channel.SendMessageAsync("ℹ️ Current **DM greet** message: `" + config.ChannelGreetMessageText?.SanitizeMentions() + "`"); + await channel.SendMessageAsync("ℹ️ Current **DM greet** message: `" + config.DmGreetMessageText?.SanitizeMentions() + "`"); return; } @@ -292,7 +292,7 @@ namespace NadekoBot.Modules.Administration using (var uow = DbHandler.UnitOfWork()) { var conf = uow.GuildConfigs.For(guildId); - conf.ChannelGreetMessageText = message; + conf.DmGreetMessageText = message; greetMsgEnabled = conf.SendChannelGreetMessage; uow.GuildConfigs.Update(conf); From 140ec95e04b5ce41d53d777c336b7bbf5d7e7798 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Thu, 1 Dec 2016 00:45:39 +0100 Subject: [PATCH 5/5] And proper return value --- .../Modules/Administration/Commands/ServerGreetCommands.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NadekoBot/Modules/Administration/Commands/ServerGreetCommands.cs b/src/NadekoBot/Modules/Administration/Commands/ServerGreetCommands.cs index 9cd57875..3afcb46c 100644 --- a/src/NadekoBot/Modules/Administration/Commands/ServerGreetCommands.cs +++ b/src/NadekoBot/Modules/Administration/Commands/ServerGreetCommands.cs @@ -293,7 +293,7 @@ namespace NadekoBot.Modules.Administration { var conf = uow.GuildConfigs.For(guildId); conf.DmGreetMessageText = message; - greetMsgEnabled = conf.SendChannelGreetMessage; + greetMsgEnabled = conf.SendDmGreetMessage; uow.GuildConfigs.Update(conf); uow.Complete();