| View previous topic :: View next topic |
| Author |
Message |
Kingy Voice
Joined: 15 Dec 2008 Posts: 3
|
Posted: Mon Dec 15, 2008 11:52 pm Post subject: login to bot to use command |
|
|
Ok so what i'm trying to do is let users log into the bot so they can use commands. When they login it gives them a specific flag (+G) and then all commands are based off G. when they part/quit it takes it away.
Now i have the login all working and it adds/takes the flag, but users can't seem to use the commands. Here is some of the code
| Code: |
bind msg G .commands proc_commands
bind msg - .login proc_login
bind msg G .logout proc_logout
proc proc_login { nick uhost hand text } {
global host user pass db
set con [::mysql::connect -host $host -user $user -password $pass]
set res [::mysql::use $con $db]
set md5pass [md5 $text]
set query [::mysql::query $con "SELECT * FROM users WHERE username='$nick' AND password='$md5pass'"]
if {[set row [::mysql::fetch $query]] == ""} {
putserv "PRIVMSG $nick :Incorrect Login"
} else {
putserv "PRIVMSG $nick :Logged in"
adduser $nick
chattr $nick +G
}
::mysql::endquery $query
::mysql::close $con
}
proc proc_commands { nick uhost hand text } {
putserv "PRIVMSG $nick :All commands can be accessed in this private chat, or by typing /msg K1-Bot <command>"
putserv "PRIVMSG $nick :-"
putserv "PRIVMSG $nick :Commands:"
putserv "PRIVMSG $nick :.logout (Logs you out of the bot)"
}
|
Now, when i login it seems to work, but doesn't work when another user does it. Any reason why? |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Tue Dec 16, 2008 3:15 pm Post subject: |
|
|
| Quote: | adduser <handle> [hostmask]
Description: creates a new user entry with the handle and hostmask given
(with no password and the default flags)
Returns: 1 if successful; 0 if the handle already exists
Module: core
|
Then have a look at this part of the code:
| Code: | adduser $nick
chattr $nick +G
|
Basically, you're creating a new user-account (based on nickname), but neglect to add any hostmasks to it. Hence your eggdrop cannot identify the user as the user-account. Add a proper hostmask.
Also, I would strongly suggest that you add some mechanism to check that the added handle-name does not already exists (or test the result of the adduser command). _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|