2 · General commands - teuk/mediabot_v3 GitHub Wiki
The bot connects to a random irc server attached to defined network in config file.
Then it will join console channel (you should have added one during configure stage).
Note : If user mode +x is set on Undernet network, it will use a random nick and wait for X successfull login Then the bot try to change to its defined nick.
If Freenode/Libera network type is defined and a password is defined it will authenticate to NickServ.
At the begining the database USER table is empty and you have to register as Owner of the bot.
Once you had the bot running, you have to send it a message to be the Owner
/msg mediabot register username password
Example
[06:47:35] -> *mediabot* register teuk MediabotDemoPassword
[06:47:35] -mediabot- You just registered as teuk (id_user : 2) as Owner with hostmask *[email protected]
[06:47:35] -mediabot:#mediabot- (teuk : Te[u][email protected]) command register Success
[06:47:35] -mediabot:#mediabot- (teuk : Te[u][email protected]) command registerChannel Te[u]K registered user : 2 level 500 on channel : 1
And in mediabot.log
[06/08/2022 06:47:35] Te[u][email protected] wants to register
[06/08/2022 06:47:35] Registered teuk (id_user : 2) as Owner with hostmask *[email protected]
[06/08/2022 06:47:35] -> -Te[u]K- You just registered as teuk (id_user : 2) as Owner with hostmask *[email protected]
[06/08/2022 06:47:35] -> -#mediabot- (teuk : Te[u][email protected]) command register Success
[06/08/2022 06:47:35] -> -#mediabot- (teuk : Te[u][email protected]) command registerChannel Te[u]K registered user : 2 level 500 on channel : 1
[06/08/2022 06:47:35] registerChan successfull #mediabot teuk
You'll be known as "username" and will be Owner. The command register cannot be used anymore (unless you flush USER table...). You can see that the bot notices its actions on the console channel.
Now you can login to the bot using
/msg mediabot login username password
Example
[06:53:32] -> *mediabot* login teuk MediabotDemoPassword
[06:53:32] -mediabot- Login successfull as teuk (Level : Owner)
[06:53:32] -mediabot:#mediabot- Te[u][email protected] Successfull login as teuk (Level : Owner)
[06:53:32] -mediabot:#mediabot- (teuk : Te[u][email protected]) command login teuk Success
Now you're logged into the bot and will be able to use commands with Owner global level.
Note : if you have an undernet hidden host (+x), you'll be logged in the bot without using login command. This behavior can be set for other hostmasks by setting autologin to on for a user (see moduser command).
In mediabot there are two types of levels.
Global ones
-
Owner (there should be only one user with this level, the one who registered the bot)
-
Master (this one is the maximum level you should give to a user and that gives a lot of power)
-
Administrator
-
User (this is the basic level you should use if yo don't know which one to choose, see adduser command)
Channels ones (from 0 to 500), those levels are assigned for a channel and are quite similar with cservice X ones on Undernet
-
500: part
-
450: join chanset
-
400: add del modinfo
-
100: op deop invite
-
50: kick topic
-
25: voice devoice
-
0: access chaninfo login pass newpass ident showcommands
For example, a user with a global level of 'User' can have a channel level of 500, which means they are the owner of the channel.
To add a user you need to have at least a Master global level. When you register the bot, a user is created for you with Owner level.
To add a user
/msg mediabot adduser [-n] username ident@host level
The -n option will notice that he has been added (be carefull no check is made between the username you choose and the actual user's nickname)
Example
Check the whois for the user you want to add
/whois foo
[20:59:07] foo is [email protected] * foobar
[20:59:07] foo on #irc
[20:59:07] foo using *.mediabot.rules The Undernet Underworld
[20:59:07] foo End of /WHOIS list.
And add it with a User global level
/msg mediabot adduser -n foo *[email protected] User
[21:05:03] -mediabot:#mediabot- Added user foo id_user : 3 with hostmask *[email protected] (Level:User)
[21:05:03] -mediabot- Added user foo id_user : 3 with hostmask *[email protected] (Level:User)
[21:05:07] -mediabot:#mediabot- (teuk : Te[u][email protected]) command adduser Added user foo id_user : 3 with hostmask *[email protected] (Level:User)
In the log file (mediabot.log)
[06/08/2022 21:05:04] Added user : foo with hostmask : *[email protected] id_user : 3 as User password set : no
[06/08/2022 21:05:04] addUser() id_user : 3 foo Hostmask : *[email protected] (Level:User)
[06/08/2022 21:05:04] -> -#mediabot- Added user foo id_user : 3 with hostmask *[email protected] (Level:User)
[06/08/2022 21:05:04] -> -Te[u]K- Added user foo id_user : 3 with hostmask *[email protected] (Level:User)
[06/08/2022 21:05:04] -> -foo- You've been added to mediabot as user foo (Level : User)
[06/08/2022 21:05:04] -> -foo- /msg mediabot pass password
[06/08/2022 21:05:04] -> -foo- replace 'password' with something strong and that you won't forget :p
[06/08/2022 21:05:04] -> -#mediabot- (teuk : Te[u][email protected]) command adduser Added user foo id_user : 3 with hostmask *[email protected] (Level:User)
You can see that the bot noticed the user foo, and asked him to set a password using the "pass" command. This what sees foo user from his side
|21:05:04 BNC -- | mediabot ([email protected]): You've been added to mediabot as user foo (Level : User)
│21:05:04 BNC -- | mediabot ([email protected]): /msg mediabot pass password
│21:05:06 BNC -- | mediabot ([email protected]): replace 'password' with something strong and that you won't forget :p
Got to the console chan (or whatever channel the bot is on) and use userinfo command
#mediabot:<@Te[u]K> m userinfo foo
[21:54:39] -mediabot- User : foo (Id: 3 - User) - created 2022-08-06 21:05:04 - last login
[21:54:39] -mediabot- Password is not set (not logged in) Force AUTOLOGIN : OFF
[21:54:39] -mediabot- Hostmasks : *[email protected]
[21:54:39] -mediabot- Infos : N/A - N/A
[21:54:39] -mediabot:#mediabot- Te[u][email protected] userinfo on foo
[21:54:41] -mediabot:#mediabot- (teuk : Te[u][email protected]) command userinfo Te[u][email protected] userinfo on foo
You can modify some information for a user with command moduser.
m moduser username level newlevel
Example :
Go to the console channel or wherever the bot it and use moduser
[12:29:33] <@Te[u]K> m moduser foo level Administrator
[12:29:33] -mediabot- User foo is now a global Administrator of the bot
[12:29:33] -mediabot:#mediabot- (teuk : Te[u][email protected]) command moduser foo level Administrator on #mediabot
The user foo we added with a User global level has now an Administrator global level ! You can check it with userinfo
[12:31:21] <@Te[u]K> m userinfo foo
[12:31:21] -mediabot- User : foo (Id: 3 - Administrator) - created 2022-08-06 21:05:04 - last login
[12:31:21] -mediabot- Password is not set (not logged in) Force AUTOLOGIN : OFF
[12:31:21] -mediabot- Hostmasks : *[email protected]
[12:31:21] -mediabot- Infos : N/A - N/A
[12:31:21] -mediabot:#mediabot- Te[u][email protected] userinfo on foo
[12:31:23] -mediabot:#mediabot- (teuk : Te[u][email protected]) command userinfo Te[u][email protected] userinfo on foo
Set user autologin on/off (default off but Undernet's hidden host)
If a user has a host you trust, instead of forcing him to login to the bot (and most of them will thank you cause login is boring ^^)
Go to the console channel or wherever the bot is
m moduser username autologin on
Example
[12:35:49] <@Te[u]K> m moduser foo autologin on
[12:35:49] -mediabot- Set autologin ON for user foo
[12:35:49] -mediabot:#mediabot- (teuk : Te[u][email protected]) command moduser foo autologin on on #mediabot
You can check it with userinfo command, you can set it to off the same way. When it's on the first time the user will try to use a command that needs authentication, he'll be auto-logged.
To delete a user (be carefull no checks are made), with a Master global access
m deluser username
or
/msg mediabot deluser username
To add a channel for a user (or yourself) you must have at least a Master global level. The syntax is
m addchan #channel username
When you do that the bot will join the chan and add a record in database and username will have a 500 channel access level (he'll be the owner of the chan).
Example on console chan we add the channel #irc to user foo
[13:01:42] <@Te[u]K> m addchan #irc foo
[13:01:42] -mediabot:#mediabot- Te[u][email protected] addchan command teuk added #irc (id_channel : 2)
[13:01:42] -mediabot:#mediabot- (teuk : Te[u][email protected]) command addchan #irc #irc foo
[13:01:42] -mediabot:#mediabot- (teuk : Te[u][email protected]) command registerChannel Te[u]K registered user : 3 level 500 on channel : 2
The bot joined #irc (if it's allowed)
[13:01:42] * Joins: mediabot ([email protected])
The user foo wil now be able to add existing bot users (that means who had been "adduser" with a minimum User global level). See the "add" command.
You can check a channel record with command chaninfo
m chaninfo #channel
Example
[13:09:48] <@Te[u]K> m chaninfo #irc
[13:09:48] -mediabot- #irc is registered by foo - last login: Never
[13:09:48] -mediabot- Creation date : 2022-08-07 13:01:42 - Description : #irc
[13:09:48] -mediabot- Chan modes : Not set - Key : Not set - Auto join : True
[13:09:48] -mediabot:#mediabot- (teuk : Te[u][email protected]) command chaninfo on #irc
To purge a channel you need to have at least a Master global level and use the purge command
m purge #channel
The channel is not actually totally removed from the database, the bot move it to a new table CHANNEL_PURGED. It will part the channel just after the command has been issued. Be careful if you use that command, if you want to rollback you'll need to do it manually in the DB it's not that simple.
Now see Channel related commands : https://github.com/teuk/mediabot_v3/wiki/3-%C2%B7-Channel-related-commands