• If you need help or want to discuss things, you now can also join us on our Discord Server!
  • A first preview of the unlimited version of SinusBot can be found in the Upcoming Changes thread. A version for Windows will follow, but we don't have a release date, yet.

EN Need some help in developing my script

Status
Not open for further replies.

Blooder

Member
Hello,
I am pretty new to javaScript and any kind of programming and just started some tutorials, because i wanna learn how to write own scripts.
At the moment i am trying to write a script that does the following:
  • If a user joins a specific channel ( for expample searching for Cs:Go mates) the bot will automatically send a Message to all online Users with the Server Group Cs:Go ! I want to make multiline where everybody can insert his own message.
  • Lets say the message we choose says : "Do you want to play with "User(%n --> name of client who joined the channel) Cs:Go? If so please reply with !p(<-- the command we have defined for choosing to play with a user.)
  • When somebody replys the bot with !p the user searching for mates will automaticly get moved into the channel of the perosn who replyed with !p
I dont got with my scipt very far. At the moment it looks like this(code is green for an better overview):

registerPlugin({
name: 'Gaming channel Search member information',
version: '1.0',
description: 'Messages clients of one specific Servergroup, for example a gaming Group named Cs:Go, if a user joins a specific channel, for example searching cs mates',
author: 'Blooder',
vars: [
{
name: 'Channel',
indent: 1,
title: 'Select the specific Channel, in which when a user joins all clients of a certain group get a message',
type: 'channel'
},
{
name: 'ServerGroup',
indent: 3
title: 'Server group IDs that will get messaged if a user joines the choosen channel',
type: 'strings'
},
{
name: 'msg',
indent: 1
title: 'The message that should be sent to all online users of a specific Group',
type: 'multiline'
},
{
name: 'type',
indent: 2
title: 'Message-Type',
type: 'select'
options: [
'Private chat',
'Poke'
},
{
name: 'playWithUser',
indent: 2,
title: 'The command that the user needs to reply if he wants to play with the user searching for mates',
placeholder: 'Default: !play',
type: 'string'
},
]
}, function(sinusbot, config) {

var event = require('event');
var engine = require('engine');
var store = require('store');
var backend = require('backend');


Now i want to insert an if case. Which says:
  • If a user joins the channel which was selected in var(channel) a msg will be sent to all online Members of the group selected in var(ServerGroup)
 

Blooder

Member
Oh and pls dont just send the answer for that pls explain why you did it like that. I wanna understand it in order to create scripts without help
 

irgendwr

no longer active, "retired" staff member
is awesome!
V.I.P.
is uber awesome!
Contributor
Insider
When pasting code into a post either embed it in code tags: [ CODE ] <your code here> [/ CODE ] or use an external service like pastebin to make it look neater.

59377364.jpg
 
Status
Not open for further replies.
Top