Skip to content

kl3mta3/XilftenBot

Repository files navigation

XilftenBot

XilftenBot is a Discord bot used to allow the ability to communicate with Sonarr and Radarr API for the purpose of adding shows and movies.

No need For Ombi, Overseer. No external web servers to configure or extra software to Install.

It was created with the intent to allow users of a discord server to have the ability to add media, without having to provide them access to Sonarr or Radarr, which can be risky. At it's core the goal is to allow easy access for adding media, while avoiding risk or damage to the Databases by uneducated users.

XilftenBot CAN NOT Delete, Edit, or Move any existing media. Adding other Fuctions not included can dangerous and Not Intended or Recommended. Do at your own risk.

Tip

Always use the Sonarr and Radarr WebUI for modifying Existing media.



How to Use

Getting XilftenBot running is straight forward and easy. You only Need Sonarr, or Radarr or both, and a Discord bot registered with Discord(We will discuss this later) This guide assumes you have Sonarr and Radarr installed and accessable outside of the localhost.

Note

You can use localHost. You just have to ensure XilftenBot runs on the same machine as Sonarr and Radarr.


If you do not have Sonarr installed Documents and download can be found at http://Sonarr.tv.

If you do not have Radarr installed Documents and download can be found at http://Radarr.video.

XilftenBot is a preProgramed Discord bot, and needs a Bot Token provided by Discord you can get one at http://discord.com/developers. A guide to creating it can be found here



Installation:

Download the zip or complie and build XilftenBot.

Inside the folder you will find a file named "XilftenBot.dll.config".

Open the file in notepad or your editor of choice.

Inside you will find the following config file. We need to fill this in to Configure XilftenBot to our Discord, Sonarr and Radarr servers.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    
    <!-- This is your Bots Discord Token Example: "qqwe7q6w7e6qw7e67w6eq7.kjhkjn2kj31k23jn1k2j3nkDawda"-->
    <!-- You can get this when you create and register a bot at https://discord.com/developers/-->
      <add key="Token" value="" />

    <!-- This is your Guilds Id Example: "123456789876"-->
    <!-- You can get this by right clicking the Guild(server) at the top, in Discord and clicking copy Server ID-->
    <add key="GuildId" value="" />

    <!-- Your External Sonarr IP. Example: "http://123.456.7.8:1234/" -->
      <add key="SonarrIP" value="" />

    <!-- Your Sonarr API Key. You can get this from Sonarr Settings/General/Security -->
      <add key="SonarrAPIKey" value="" />

    <!-- Your External Radarr IP. Example: "http://123.456.7.8:1234/" -->
      <add key="RadarrIP" value="" />

    <!-- Your Radarr API Key. You can get this from Radarr Settings/General/Security -->
      <add key="RadarrAPIKey" value="" />
  
  </appSettings>
</configuration>

You can see we need 6 pieces of Information to fully Configure the bot.

  1. Token is your Bots Token provided when you create the bot on Discord.com/Developers. Ex: 1231d12dasda98sdahsd.123kj12k3j12kmdk12jnb
  2. GuildId id the Id of the Discord server you added to bot to. You can get this by right clicking the server name at the top, in Discord and clicking copy Server ID
  3. SonarrAPI is your Sonarr API Key and is Located in Sonarr Settings/General/Security.
  4. Sonarr IP is the address in your browser when you connect to Sonarr with. Ex: http://123.456.7.8:8989/ or http://localhost:8989/
  5. RadarrAPI is your Radarr API Key and is Located in Radarr Settings/General/Security.
  6. Radarr IP is the address in your browser when you connect to Radarr with. Ex: http://123.456.7.8:7878/ or http://localhost:7878/

Once we have all that entered we can start the bot. Thats it, it is ready to use from Discord.



Using the Bot Inside Discord

XilftenBot uses Application Commands. Application commands come in two options Global(work on every server the bot is on) and Guild(Server) specific. Due to the nature of the Tasks XilftenBot performs, by default it is set to use Guild Specific Application Commands. This ensures if you accidentally make the bot public and someone adds it to their Discord server, they can't affect Sonarr or Radarr.

If you wish the Commands to be accessable Globally ( Work in many Servers) it can be done as follows.

Open the file Xilften.cs and locate the following code.

var slash = discord.UseSlashCommands();
slash.RegisterCommands<RadarrCommand>(guildID);
slash.RegisterCommands<BotCommand>(guildID);
slash.RegisterCommands<SonarrCommand>(guildID);

Change it to,

var slash = discord.UseSlashCommands();
slash.RegisterCommands<RadarrCommand>();
slash.RegisterCommands<BotCommand>();
slash.RegisterCommands<SonarrCommand>();

Once done, save, rebuild the project and restart the app. Now it will register the Application Commands Globally

Warning

Global Application commands can take an hour to register with Discord, And once Registered can not be removed without the use of an API call or by deleting the app on Discord.com and rebuilding a new bot there.


Best Discord Setting for XilftenBot

Our Application Command including the ones requiring Admin Access are all visible.

To better ensure only the users we want to use the commands can see them we need to change a few settings in the Discord server.


Roles

To aid in the above goal we need to create a few rolls. We Assume you already have an Admin roll with Admin access.

We need to create Two more. For this guide we will call them CanAddShows and CanAddMovies.

To create a new role, Go to the server setting by clicking the icon to the right of the server name in Discord.

Once in settings Click on Roles, then "Create Role" give the roll a name and save.

After you have both roles made we need assign CanAddShows to anyone we want to access /TV to add shows and assign CanAddMovies to people we want to have access to /Movies. This allows us to restrict each action to a user incase we want some people to only add one or the other.


Permissions

Now we need to set the permissions for the commands to all and show for only the roles we want. Head to your Servers Settings again by clicking on the icon to the right of the name. This time we need to click on Intergrations in the Apps section.

Here you should see your bots name in its tab under "Bots and Apps". Click on "Manage", located on the right of your bots tab. We need to add the 3 roles we want and give access. but we also need to remove access for @everyone so only the people we want can see and interact with the bot.

Set it as in the image below.

Bot Permissions

Below this you will see a list of all the commands XilftenBot registered with Discord when it Connected.

commands1

Go through each command and Set its permissions, Keep in mind

  • Only CanAddShows and Admin should have access to /TV
  • Only CanAddMovie and Admin should have access to /Movies
  • All Commands should have @everyone restricted.
  • All Commands should have Admin Allowed.

helpCommandPermission

For /TV and /Movies we need to also restrict requests to the specific channel for requests. This is to keep the server clean and prevent Requests from cluttering up every channel. click on add channel and choose a channel.

movieCommandPermission

Thats it Save your settings and Its all set up and ready for users to use.

Using The Commands

How to search for a series.

Go to the Request channel and Type / Discord will suggest possible commands. Choose Tv or type Tv and press space. Then provide a show name and ideally year in the format "SeriesName (2024)".

If the Show exists on the server you will Recieve a respons like the following. Showing the shows info.

tvrequestontherserver

If the show doesnt exist then You will receive a reponse like this.

Shownotonserver

Respond with the "okay" emoji đź‘Ś within 30 seconds and it will add the show to the server.

showaddedtoserver


How to search for a movie.

Go to the Request channel and Type / Discord will suggest possible commands. Choose Movie or type movie and press space. Then provide a movie name and ideally year in the format "MovieName (2024)".

If the movie exists on the server you will Recieve a response like the following. Showing the movie info.

Movieonserver

If the movie doesnt exist then You will receive a reponse like this.

Movienotonserver

Respond with the "okay" emoji đź‘Ś within 30 seconds and it will add the movie to the server.

moviesaddedtoserver


If you need help, have suggestions, or need to report a bug. Join the Discord at https://discord.gg/S8vdPAsdzH.




That's it you are done. Why are you still here? Go add shows to your server!







Below is the guide for creating your discord bot if you dont have one. XilftenBots specificlly needed permissions and Intents are provided within the guide I'd you need them. But if you've gotten this far aleady you dont need to worry with it.
























Keep going.


















Almost there.











































You made it.

Creating Your Discord Bot

Step 1: Log into your Discord account and click on “Advanced” in the sidebar. Then activate “Developer Mode”. Then click on “Discord API”.

how-to-activate-developer-mode

Activate “Developer Mode” in your Discord account and then click on “Discord API”

Step 2: In the Developer Portal, click on “Applications” in the sidebar on the left. Log in to your account again and then click on “New Application”.

New-application

Click on “Applications” and then “New Application”.
Step 3: Give your bot a name and then click on “Create”.

step 3

Choose a name for your bot and then click “Create”

Step 4: Click on “Bot” in the left sidebar, then click on “Add Bot” to create a bot account and bot token. Take note of the token, as this is the how the bot communicates with the API.

step 4

Click on “Add Bot” to generate a Bot token.

Step 5: Back in Developer Mode in Discord, go to “General Information” and set details like the description and app icon.

step 6

Under “General Information”, you can set details like a description and icon for your bot.

Step 6: Go to “OAuth2” and in the field “Scopes” check the box for “bot”. Then set the permissions for your Discord bot.

step 7

Under “OAuth2”, you can set the permission for your bot.

Here is the XilftenBots minimum permissions.

minimumBotPermissions

Step 7: The authentication link including client ID should look as follows:

step 8

Take care of the final settings for your bot and click “Copy”.

Step 8: Select your Discord server in order to add the bot to your server.





About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages