fixed v+t erroring when bot has no permissions, fix commandlist
This commit is contained in:
parent
8304d915d4
commit
b02119c673
@ -22,10 +22,26 @@ namespace NadekoBot.Commands {
|
|||||||
// changing servers may cause bugs
|
// changing servers may cause bugs
|
||||||
NadekoBot.Client.UserUpdated += async (sender, e) => {
|
NadekoBot.Client.UserUpdated += async (sender, e) => {
|
||||||
try {
|
try {
|
||||||
|
if (e.Server == null)
|
||||||
|
return;
|
||||||
var config = SpecificConfigurations.Default.Of(e.Server.Id);
|
var config = SpecificConfigurations.Default.Of(e.Server.Id);
|
||||||
if (e.Before.VoiceChannel == e.After.VoiceChannel) return;
|
if (e.Before.VoiceChannel == e.After.VoiceChannel) return;
|
||||||
if (!config.VoicePlusTextEnabled)
|
if (!config.VoicePlusTextEnabled)
|
||||||
return;
|
return;
|
||||||
|
var serverPerms = e.Server.GetUser(NadekoBot.Client.CurrentUser.Id)?.ServerPermissions;
|
||||||
|
if (serverPerms == null)
|
||||||
|
return;
|
||||||
|
if (!serverPerms.Value.ManageChannels || !serverPerms.Value.ManageRoles) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
await e.Server.Owner.SendMessage(
|
||||||
|
"I don't have manage server and/or Manage Channels permission," +
|
||||||
|
$"so I cannot run voice+text on **{e.Server.Name}** server.");
|
||||||
|
} catch { } // meh
|
||||||
|
config.VoicePlusTextEnabled = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var beforeVch = e.Before.VoiceChannel;
|
var beforeVch = e.Before.VoiceChannel;
|
||||||
if (beforeVch != null) {
|
if (beforeVch != null) {
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Discord;
|
using Discord;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NadekoBot.Extensions;
|
using NadekoBot.Extensions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -513,17 +514,17 @@ namespace NadekoBot.Modules {
|
|||||||
Channel commsChannel = null;
|
Channel commsChannel = null;
|
||||||
|
|
||||||
cgb.CreateCommand(Prefix + "commsuser")
|
cgb.CreateCommand(Prefix + "commsuser")
|
||||||
.Description("Sets a user for through-bot communication. Only works if server is set. Resets commschannel.**Owner only**.")
|
.Description("Sets a user for through-bot communication. Only works if server is set. Resets commschannel.**Owner only**.")
|
||||||
.Parameter("name", ParameterType.Unparsed)
|
.Parameter("name", ParameterType.Unparsed)
|
||||||
.Do(async e => {
|
.Do(async e => {
|
||||||
if (!NadekoBot.IsOwner(e.User.Id)) return;
|
if (!NadekoBot.IsOwner(e.User.Id)) return;
|
||||||
commsUser = commsServer?.FindUsers(e.GetArg("name")).FirstOrDefault();
|
commsUser = commsServer?.FindUsers(e.GetArg("name")).FirstOrDefault();
|
||||||
if (commsUser != null) {
|
if (commsUser != null) {
|
||||||
commsChannel = null;
|
commsChannel = null;
|
||||||
await e.Channel.SendMessage("User for comms set.");
|
await e.Channel.SendMessage("User for comms set.");
|
||||||
} else
|
} else
|
||||||
await e.Channel.SendMessage("No server specified or user.");
|
await e.Channel.SendMessage("No server specified or user.");
|
||||||
});
|
});
|
||||||
|
|
||||||
cgb.CreateCommand(Prefix + "commsserver")
|
cgb.CreateCommand(Prefix + "commsserver")
|
||||||
.Description("Sets a server for through-bot communication.**Owner only**.")
|
.Description("Sets a server for through-bot communication.**Owner only**.")
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
######You can donate on paypal: `nadekodiscordbot@gmail.com` or Bitcoin `17MZz1JAqME39akMLrVT4XBPffQJ2n1EPa`
|
######You can donate on paypal: `nadekodiscordbot@gmail.com` or Bitcoin `17MZz1JAqME39akMLrVT4XBPffQJ2n1EPa`
|
||||||
|
|
||||||
#NadekoBot List Of Commands
|
#NadekoBot List Of Commands
|
||||||
Version: `NadekoBot v0.9.5919.5387`
|
Version: `NadekoBot v0.9.5922.6892`
|
||||||
### Administration
|
### Administration
|
||||||
Command and aliases | Description | Usage
|
Command and aliases | Description | Usage
|
||||||
----------------|--------------|-------
|
----------------|--------------|-------
|
||||||
@ -178,7 +178,7 @@ Command and aliases | Description | Usage
|
|||||||
`>pollend` | Stops active poll on this server and prints the results in this channel.
|
`>pollend` | Stops active poll on this server and prints the results in this channel.
|
||||||
`>choose` | Chooses a thing from a list of things | >choose Get up;Sleep;Sleep more
|
`>choose` | Chooses a thing from a list of things | >choose Get up;Sleep;Sleep more
|
||||||
`>8ball` | Ask the 8ball a yes/no question.
|
`>8ball` | Ask the 8ball a yes/no question.
|
||||||
`>attack` | Attack a person. Supported attacks: 'splash', 'strike', 'burn', 'surge'. | > strike @User
|
`>attack` | Attack a person. Supported attacks: 'splash', 'strike', 'burn', 'surge'. | >attack strike @User
|
||||||
`>poketype` | Gets the users element type. Use this to do more damage with strike!
|
`>poketype` | Gets the users element type. Use this to do more damage with strike!
|
||||||
`>rps` | Play a game of rocket paperclip scissors with nadkeo. | >rps scissors
|
`>rps` | Play a game of rocket paperclip scissors with nadkeo. | >rps scissors
|
||||||
`>linux` | Prints a customizable Linux interjection
|
`>linux` | Prints a customizable Linux interjection
|
||||||
@ -217,6 +217,7 @@ Command and aliases | Description | Usage
|
|||||||
`~twitch`, `~tw` | Notifies this channel when a certain user starts streaming. | ~twitch SomeStreamer
|
`~twitch`, `~tw` | Notifies this channel when a certain user starts streaming. | ~twitch SomeStreamer
|
||||||
`~removestream`, `~rms` | Removes notifications of a certain streamer on this channel. | ~rms SomeGuy
|
`~removestream`, `~rms` | Removes notifications of a certain streamer on this channel. | ~rms SomeGuy
|
||||||
`~liststreams`, `~ls` | Lists all streams you are following on this server. | ~ls
|
`~liststreams`, `~ls` | Lists all streams you are following on this server. | ~ls
|
||||||
|
`~we` | Shows weather data for a specified city and a country BOTH ARE REQUIRED. Weather api is very random if you make a mistake.
|
||||||
`~yt` | Searches youtubes and shows the first result
|
`~yt` | Searches youtubes and shows the first result
|
||||||
`~ani`, `~anime`, `~aq` | Queries anilist for an anime and shows the first result.
|
`~ani`, `~anime`, `~aq` | Queries anilist for an anime and shows the first result.
|
||||||
`~mang`, `~manga`, `~mq` | Queries anilist for a manga and shows the first result.
|
`~mang`, `~manga`, `~mq` | Queries anilist for a manga and shows the first result.
|
||||||
@ -247,9 +248,9 @@ Command and aliases | Description | Usage
|
|||||||
`,createwar`, `,cw` | Creates a new war by specifying a size (>10 and multiple of 5) and enemy clan name. | ,cw 15 The Enemy Clan
|
`,createwar`, `,cw` | Creates a new war by specifying a size (>10 and multiple of 5) and enemy clan name. | ,cw 15 The Enemy Clan
|
||||||
`,sw`, `,startwar` | Starts a war with a given number.
|
`,sw`, `,startwar` | Starts a war with a given number.
|
||||||
`,listwar`, `,lw` | Shows the active war claims by a number. Shows all wars in a short way if no number is specified. | ,lw [war_number] or ,lw
|
`,listwar`, `,lw` | Shows the active war claims by a number. Shows all wars in a short way if no number is specified. | ,lw [war_number] or ,lw
|
||||||
`,claim`, `,call`, `,c` | Claims a certain base from a certain war. You can supply a name in the third optional argument to claim in someone else's place. | ,call [war_number] [base_number] (optional_otheruser)
|
`,claim`, `,call`, `,c` | Claims a certain base from a certain war. You can supply a name in the third optional argument to claim in someone else's place. | ,call [war_number] [base_number] [optional_other_name]
|
||||||
`,cf`, `,claimfinish` | Finish your claim if you destroyed a base. Optional second argument finishes for someone else. | ,cf [war_number] (optional_other_name)
|
`,cf`, `,claimfinish` | Finish your claim if you destroyed a base. Optional second argument finishes for someone else. | ,cf [war_number] [optional_other_name]
|
||||||
`,unclaim`, `,uncall`, `,uc` | Removes your claim from a certain war. Optional second argument denotes a person in whos place to unclaim | ,uc [war_number] (optional_other_name)
|
`,unclaim`, `,uncall`, `,uc` | Removes your claim from a certain war. Optional second argument denotes a person in whos place to unclaim | ,uc [war_number] [optional_other_name]
|
||||||
`,endwar`, `,ew` | Ends the war with a given index. | ,ew [war_number]
|
`,endwar`, `,ew` | Ends the war with a given index. | ,ew [war_number]
|
||||||
|
|
||||||
### Trello
|
### Trello
|
||||||
|
Loading…
Reference in New Issue
Block a user