commit
a1228f40f3
@ -1,14 +1,14 @@
|
||||
![img](https://ci.appveyor.com/api/projects/status/gmu6b3ltc80hr3k9?svg=true)
|
||||
[![Discord](https://discordapp.com/api/guilds/117523346618318850/widget.png)](https://discord.gg/0ehQwTK2RBjAxzEY)
|
||||
[![Documentation Status](https://readthedocs.org/projects/nadekobot/badge/?version=latest)](http://nadekobot.readthedocs.io/en/1.0/?badge=latest)
|
||||
[![Documentation Status](https://readthedocs.org/projects/nadekobot/badge/?version=latest)](http://nadekobot.readthedocs.io/en/latest/?badge=latest)
|
||||
# NadekoBot
|
||||
[![nadeko1](https://cdn.discordapp.com/attachments/155726317222887425/252095170676391936/A1.jpg)](https://discordapp.com/oauth2/authorize?client_id=170254782546575360&scope=bot&permissions=66186303)
|
||||
[![nadeko2](https://cdn.discordapp.com/attachments/155726317222887425/252095207514832896/A2.jpg)](http://nadekobot.readthedocs.io/en/1.0/Commands%20List/)
|
||||
[![nadeko2](https://cdn.discordapp.com/attachments/155726317222887425/252095207514832896/A2.jpg)](http://nadekobot.readthedocs.io/en/latest/Commands%20List/)
|
||||
|
||||
##For Update, Help and Guidlines
|
||||
|
||||
`Follow me on twitter for updates. | Join my Discord server if you need help. | Read the Docs for hosting guides.`
|
||||
|
||||
[![twitter](https://cdn.discordapp.com/attachments/155726317222887425/252192520094613504/twiter_banner.JPG)](https://twitter.com/TheNadekoBot) [![discord](https://cdn.discordapp.com/attachments/155726317222887425/252192415673221122/discord_banner.JPG)](https://discord.gg/0ehQwTK2RBjAxzEY) [![Wiki](https://cdn.discordapp.com/attachments/155726317222887425/252192472849973250/read_the_docs_banner.JPG)](http://nadekobot.readthedocs.io/en/1.0/)
|
||||
[![twitter](https://cdn.discordapp.com/attachments/155726317222887425/252192520094613504/twiter_banner.JPG)](https://twitter.com/TheNadekoBot) [![discord](https://cdn.discordapp.com/attachments/155726317222887425/252192415673221122/discord_banner.JPG)](https://discord.gg/0ehQwTK2RBjAxzEY) [![Wiki](https://cdn.discordapp.com/attachments/155726317222887425/252192472849973250/read_the_docs_banner.JPG)](http://nadekobot.readthedocs.io/en/latest/)
|
||||
|
||||
|
||||
|
@ -29,13 +29,6 @@ Command and aliases | Description | Usage
|
||||
`.ban` `.b` | Bans a user by ID or name with an optional message. **Requires BanMembers server permission.** | `.b "@some Guy" Your behaviour is toxic.`
|
||||
`.softban` `.sb` | Bans and then unbans a user by ID or name with an optional message. **Requires KickMembers server permission.** **Requires ManageMessages server permission.** | `.sb "@some Guy" Your behaviour is toxic.`
|
||||
`.kick` `.k` | Kicks a mentioned user. **Requires KickMembers server permission.** | `.k "@some Guy" Your behaviour is toxic.`
|
||||
`.setmuterole` | Sets a name of the role which will be assigned to people who should be muted. Default is nadeko-mute. **Requires ManageRoles server permission.** | `.setmuterole Silenced`
|
||||
`.mute` | Mutes a mentioned user both from speaking and chatting. **Requires ManageRoles server permission.** **Requires MuteMembers server permission.** | `.mute @Someone`
|
||||
`.unmute` | Unmutes a mentioned user previously muted with `.mute` command. **Requires ManageRoles server permission.** **Requires MuteMembers server permission.** | `.unmute @Someone`
|
||||
`.chatmute` | Prevents a mentioned user from chatting in text channels. **Requires ManageRoles server permission.** | `.chatmute @Someone`
|
||||
`.chatunmute` | Removes a mute role previously set on a mentioned user with `.chatmute` which prevented him from chatting in text channels. **Requires ManageRoles server permission.** | `.chatunmute @Someone`
|
||||
`.voicemute` | Prevents a mentioned user from speaking in voice channels. **Requires MuteMembers server permission.** | `.voicemute @Someone`
|
||||
`.voiceunmute` | Gives a previously voice-muted user a permission to speak. **Requires MuteMembers server permission.** | `.voiceunmute @Someguy`
|
||||
`.deafen` `.deaf` | Deafens mentioned user or users. **Requires DeafenMembers server permission.** | `.deaf "@Someguy"` or `.deaf "@Someguy" "@Someguy"`
|
||||
`.undeafen` `.undef` | Undeafens mentioned user or users. **Requires DeafenMembers server permission.** | `.undef "@Someguy"` or `.undef "@Someguy" "@Someguy"`
|
||||
`.delvoichanl` `.dvch` | Deletes a voice channel with a given name. **Requires ManageChannels server permission.** | `.dvch VoiceChannelName`
|
||||
@ -71,6 +64,13 @@ Command and aliases | Description | Usage
|
||||
`.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. **Requires ManageMessages server permission.** | `.repeat 5 Hello there`
|
||||
`.migratedata` | Migrate data from old bot configuration **Bot Owner only.** | `.migratedata`
|
||||
`.setmuterole` | Sets a name of the role which will be assigned to people who should be muted. Default is nadeko-mute. **Requires ManageRoles server permission.** | `.setmuterole Silenced`
|
||||
`.mute` | Mutes a mentioned user both from speaking and chatting. **Requires ManageRoles server permission.** **Requires MuteMembers server permission.** | `.mute @Someone`
|
||||
`.unmute` | Unmutes a mentioned user previously muted with `.mute` command. **Requires ManageRoles server permission.** **Requires MuteMembers server permission.** | `.unmute @Someone`
|
||||
`.chatmute` | Prevents a mentioned user from chatting in text channels. **Requires ManageRoles server permission.** | `.chatmute @Someone`
|
||||
`.chatunmute` | Removes a mute role previously set on a mentioned user with `.chatmute` which prevented him from chatting in text channels. **Requires ManageRoles server permission.** | `.chatunmute @Someone`
|
||||
`.voicemute` | Prevents a mentioned user from speaking in voice channels. **Requires MuteMembers server permission.** | `.voicemute @Someone`
|
||||
`.voiceunmute` | Gives a previously voice-muted user a permission to speak. **Requires MuteMembers server permission.** | `.voiceunmute @Someguy`
|
||||
`.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`
|
||||
@ -90,7 +90,7 @@ Command and aliases | Description | Usage
|
||||
`.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.`
|
||||
`.byemsg` | Sets a new leave announcement message. Type %user% if you want to show the name the user who left. Type %id% to show id. Using this command with no message will show the current bye message. **Requires ManageServer server permission.** | `.byemsg %user% has left.`
|
||||
`.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`
|
||||
@ -209,7 +209,7 @@ Command and aliases | Description | Usage
|
||||
`!!reptcursong` `!!rcs` | Toggles repeat of current song. | `!!rcs`
|
||||
`!!rpeatplaylst` `!!rpl` | Toggles repeat of all songs in the queue (every song that finishes is added to the end of the queue). | `!!rpl`
|
||||
`!!save` | Saves a playlist under a certain name. Name must be no longer than 20 characters and mustn't contain dashes. | `!!save classical1`
|
||||
`!!load` | Loads a playlist under a certain name. | `!!load classical-1`
|
||||
`!!load` | Loads a saved playlist using it's ID. Use `!!pls` to list all saved playlists and !!save to save new ones. | `!!load 5`
|
||||
`!!playlists` `!!pls` | Lists all playlists. Paginated. 20 per page. Default page is 0. | `!!pls 1`
|
||||
`!!deleteplaylist` `!!delpls` | Deletes a saved playlist. Only if you made it or if you are the bot owner. | `!!delpls animu-5`
|
||||
`!!goto` | Goes to a specific time in seconds in a song. | `!!goto 30`
|
||||
|
@ -42,7 +42,7 @@ There are currently three different placeholders which we will look at, with mor
|
||||
|:-----------:|-------------|---------------|-------|
|
||||
|`%mention`|The `%mention%` placeholder is triggered when you type `@BotName` - It's important to note that if you've given the bot a custom nickname, this trigger won't work!|```.acr "Hello %mention%" I, %mention%, also say hello!```|Input: "Hello @BotName" Output: "I, @BotName, also say hello!"|
|
||||
|`%user%`|The `%user%` placeholder mentions the person who said the command|`.acr "Who am I?" You are %user%!`|Input: "Who am I?" Output: "You are @Username!"|
|
||||
|`%rng%`|The `%rng%` placeholder generates a random number between 0 and 10|`.acr "Random number" %rng%`|Input: "Random number" Output: "2"|
|
||||
|`%rng%`|The `%rng%` placeholder generates a random number between 0 and 10. You can also specify a custom range (%rng1-100%) even with negative numbers: `%rng-9--1%` (from -9 to -1) . |`.acr "Random number" %rng%`|Input: "Random number" Output: "2"|
|
||||
|`%target%`|The `%target%` placeholder is used to make Nadeko Mention another person or phrase, it is only supported as part of the response|`.acr "Say this: " %target%`|Input: "Say this: I, @BotName, am a parrot!". Output: "I, @BotName, am a parrot!".|
|
||||
|
||||
Thanks to Nekai for being creative. <3
|
||||
|
@ -17,7 +17,7 @@ http://nadekobot.readthedocs.io/en/latest/JSON%20Explanations/
|
||||
|
||||
Next start the docker up with
|
||||
|
||||
```docker run nadeko; docker logs -f nadeko```
|
||||
```docker start nadeko; docker logs -f nadeko```
|
||||
|
||||
The docker will start and the log file will start scrolling past. Depending on hardware the bot start can take up to 5 minutes on a small DigitalOcean droplet.
|
||||
Once the log ends with "NadekoBot | Starting NadekoBot v1.0-rc2" the bot is ready and can be invited to your server. Ctrl+C at this point to stop viewing the logs.
|
||||
|
@ -3,6 +3,7 @@ using NadekoBot.Services;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace NadekoBot.Modules.CustomReactions
|
||||
{
|
||||
@ -17,7 +18,32 @@ namespace NadekoBot.Modules.CustomReactions
|
||||
{
|
||||
{"%mention%", (ctx) => { return $"<@{NadekoBot.Client.GetCurrentUser().Id}>"; } },
|
||||
{"%user%", (ctx) => { return ctx.Author.Mention; } },
|
||||
{"%rng%", (ctx) => { return new NadekoRandom().Next(0,10).ToString(); } }
|
||||
//{"%rng%", (ctx) => { return new NadekoRandom().Next(0,10).ToString(); } }
|
||||
};
|
||||
|
||||
private static readonly Regex rngRegex = new Regex("%rng(?:(?<from>(?:-)?\\d+)-(?<to>(?:-)?\\d+))?%", RegexOptions.Compiled);
|
||||
|
||||
private static readonly NadekoRandom rng = new NadekoRandom();
|
||||
|
||||
public static Dictionary<Regex, MatchEvaluator> regexPlaceholders = new Dictionary<Regex, MatchEvaluator>()
|
||||
{
|
||||
{ rngRegex, (match) => {
|
||||
int from = 0;
|
||||
int.TryParse(match.Groups["from"].ToString(), out from);
|
||||
|
||||
int to = 0;
|
||||
int.TryParse(match.Groups["to"].ToString(), out to);
|
||||
|
||||
if(from == 0 && to == 0)
|
||||
{
|
||||
return rng.Next(0, 11).ToString();
|
||||
}
|
||||
|
||||
if(from >= to)
|
||||
return "";
|
||||
|
||||
return rng.Next(from,to+1).ToString();
|
||||
} }
|
||||
};
|
||||
|
||||
private static string ResolveTriggerString(this string str, IUserMessage ctx)
|
||||
@ -40,6 +66,11 @@ namespace NadekoBot.Modules.CustomReactions
|
||||
{
|
||||
str = str.Replace(ph.Key.ToLowerInvariant(), ph.Value(ctx, resolvedTrigger));
|
||||
}
|
||||
|
||||
foreach (var ph in regexPlaceholders)
|
||||
{
|
||||
str = ph.Key.Replace(str, ph.Value);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using VideoLibrary;
|
||||
|
||||
namespace NadekoBot.Modules.Music.Classes
|
||||
namespace NadekoBot.Modules.Music.Classes//{(SongInfo.Provider ?? "-")}
|
||||
{
|
||||
public class SongInfo
|
||||
{
|
||||
@ -27,24 +27,29 @@ namespace NadekoBot.Modules.Music.Classes
|
||||
}
|
||||
public class Song
|
||||
{
|
||||
public StreamState State { get; set; }
|
||||
public string PrettyName =>
|
||||
$"**【 {SongInfo.Title.TrimTo(55)} 】**`{(SongInfo.Provider ?? "-")}` `by {QueuerName}`";
|
||||
$"{SongInfo.Title.TrimTo(70)}";
|
||||
public SongInfo SongInfo { get; }
|
||||
public MusicPlayer MusicPlayer { get; set; }
|
||||
|
||||
public string PrettyUser =>
|
||||
$"{QueuerName}";
|
||||
public string QueuerName { get; set; }
|
||||
|
||||
public MusicPlayer MusicPlayer { get; set; }
|
||||
public string PrettyProvider =>
|
||||
$"{(SongInfo.Provider ?? "No Provider")}";
|
||||
public StreamState State { get; set; }
|
||||
|
||||
public string PrettyCurrentTime()
|
||||
{
|
||||
var time = TimeSpan.FromSeconds(bytesSent / 3840 / 50);
|
||||
var str = $"【{(int)time.TotalMinutes}m {time.Seconds}s】**/** ";
|
||||
var str = $"{(int)time.TotalMinutes}m {time.Seconds}s / ";
|
||||
if (TotalLength == TimeSpan.Zero)
|
||||
str += "**?**";
|
||||
else if (TotalLength == TimeSpan.MaxValue)
|
||||
str += "**∞**";
|
||||
else
|
||||
str += $"【{(int)TotalLength.TotalMinutes}m {TotalLength.Seconds}s】";
|
||||
str += $"{(int)TotalLength.TotalMinutes}m {TotalLength.Seconds}s";
|
||||
return str;
|
||||
}
|
||||
|
||||
|
@ -184,8 +184,13 @@ namespace NadekoBot.Modules.Music
|
||||
{
|
||||
await musicPlayer.UpdateSongDurationsAsync().ConfigureAwait(false);
|
||||
}
|
||||
await channel.SendMessageAsync($"🎵`Now Playing` {currentSong.PrettyName} " +
|
||||
$"{currentSong.PrettyCurrentTime()}").ConfigureAwait(false);
|
||||
var embed = new EmbedBuilder()
|
||||
.WithAuthor(eab => eab.WithName("🎵 Now Playing"))
|
||||
.WithTitle($"{currentSong.PrettyName}")
|
||||
.WithDescription($"{currentSong.PrettyUser}")
|
||||
.WithFooter(ef => ef.WithText($"{currentSong.PrettyProvider} | {currentSong.PrettyCurrentTime()}"))
|
||||
.WithColor(NadekoBot.OkColor);
|
||||
await channel.EmbedAsync(embed.Build()).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
|
@ -906,7 +906,7 @@ namespace NadekoBot.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 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..
|
||||
/// Looks up a localized string similar to Sets a new leave announcement message. Type %user% if you want to show the name the user who left. Type %id% to show id. Using this command with no message will show the current bye message..
|
||||
/// </summary>
|
||||
public static string byemsg_desc {
|
||||
get {
|
||||
@ -3714,7 +3714,7 @@ namespace NadekoBot.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Loads a playlist under a certain name..
|
||||
/// Looks up a localized string similar to Loads a saved playlist using it's ID. Use `{0}pls` to list all saved playlists and {0}save to save new ones..
|
||||
/// </summary>
|
||||
public static string load_desc {
|
||||
get {
|
||||
@ -3723,7 +3723,7 @@ namespace NadekoBot.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to `{0}load classical-1`.
|
||||
/// Looks up a localized string similar to `{0}load 5`.
|
||||
/// </summary>
|
||||
public static string load_usage {
|
||||
get {
|
||||
|
@ -202,7 +202,7 @@
|
||||
<value>byemsg</value>
|
||||
</data>
|
||||
<data name="byemsg_desc" xml:space="preserve">
|
||||
<value>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.</value>
|
||||
<value>Sets a new leave announcement message. Type %user% if you want to show the name the user who left. Type %id% to show id. Using this command with no message will show the current bye message.</value>
|
||||
</data>
|
||||
<data name="byemsg_usage" xml:space="preserve">
|
||||
<value>`{0}byemsg %user% has left.`</value>
|
||||
@ -1660,10 +1660,10 @@
|
||||
<value>load</value>
|
||||
</data>
|
||||
<data name="load_desc" xml:space="preserve">
|
||||
<value>Loads a playlist under a certain name.</value>
|
||||
<value>Loads a saved playlist using it's ID. Use `{0}pls` to list all saved playlists and {0}save to save new ones.</value>
|
||||
</data>
|
||||
<data name="load_usage" xml:space="preserve">
|
||||
<value>`{0}load classical-1`</value>
|
||||
<value>`{0}load 5`</value>
|
||||
</data>
|
||||
<data name="playlists_cmd" xml:space="preserve">
|
||||
<value>playlists pls</value>
|
||||
|
@ -122,9 +122,7 @@ namespace NadekoBot.Services.Database.Repositories.Impl
|
||||
|
||||
public GuildConfig SetNewRootPermission(ulong guildId, Permission p)
|
||||
{
|
||||
var data = _set
|
||||
.Include(gc => gc.RootPermission)
|
||||
.FirstOrDefault(gc => gc.GuildId == guildId);
|
||||
var data = PermissionsFor(guildId);
|
||||
|
||||
data.RootPermission.Prepend(p);
|
||||
data.RootPermission = p;
|
||||
|
Loading…
Reference in New Issue
Block a user