Music Bot
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Music Bot

Started by frankyk, 31 March, 2004, 07:30:52

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

frankyk

Hi,

can someone write me a script that will say something like this:

User [username] tells us he is currently listening to the SONG: [song name] by BAND: [band]

so like:

+listen Jimmy Eat World - In the Middle

would get this displayed:

Bot Name: User BillyBob tells us he is currently listening to the SONG: In the Middle by BAND: Jimmy Eat World

I suppose the - would divide name of the song and band, so spaces wouldn't matter until the - shows up

nErBoS

Hi,

Hope it helps..

--Requested by frankyk
--Made by nErBoS

sBot = "Music-Bot"

function Main()
	frmHub:RegBot(sBot)
end

function DataArrival(user, data)
	if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
	data = strsub(data,1,strlen(data)-1)
	s,e,cmd = strfind(data, "%b<>%s+(%S+)")
		if (cmd=="!listen") then
			ListenMusic(user, data)
			return 1
		end
	end
end

function ListenMusic(user, data)
local s,e,author,music = strfind(data, "%b<>%s+%S+%s+(%S+)%s+(.*)")
	if (author == nil or music == nil) then
		user:SendData(sBot, "Syntax Error, !listen  , you must write a name to the author and to the music.")
	else
		SendToAll(sBot, "User "..user.sName.." tells us he is currently listening to the SONG: "..music.." by BAND: "..author)
	end
end

In the Author Name i must have instead of space a underscore in the music name is no problem.

Best regards, nErBoS
--## nErBoS Spot ##--

tezlo

or with spaces..
+listen -<br><figure class="block_code" style="font-size: medium"><pre> <code>function DataArrival(user, data) if strsub(data,1,1) == "<" then local s, e, cmd, args = strfind(data, "^%b<> %+(%a+)%s*(.*)%|$") if s and cmd == "listen" then local s, e, artist, title = strfind(args, "^(.-)%s*%-%s*(.+)$") if s then SendToAll("*** "..user.sName.." now playing "..artist.."-"..title) else user:SendData(">> syntax: +listen <artist>-<title>") end return 1 end end end </code></pre></figure> </div> </div><!-- .post --> <div class="under_message"> </div><!-- .under_message --> </div><!-- .postarea --> <div class="moderatorbar"> </div><!-- .moderatorbar --> </div><!-- .post_wrapper --> </div><!-- $message[css_class] --> <hr class="post_separator"> <div class="windowbg" id="msg18449"> <div class="post_wrapper"> <div class="poster"> <h4> <span class="off" title="Offline"></span> <a href="http://forum.ptokax.org/index.php?action=profile;u=983" title="View the profile of frankyk">frankyk</a> </h4> <ul class="user_info"> <li class="avatar"> <a href="http://forum.ptokax.org/index.php?action=profile;u=983"><img class="avatar" src="http://forum.ptokax.org/avatars//default.png" alt=""></a> </li> <li class="icons"><img src="http://forum.ptokax.org/Themes/default/images/membericons/icon.png" alt="*"><img src="http://forum.ptokax.org/Themes/default/images/membericons/icon.png" alt="*"></li> <li class="postgroup">Junior Member</li> <li class="postcount">Posts: 24</li> <li class="poster_ip">Logged</li> </ul> </div><!-- .poster --> <div class="postarea"> <div class="keyinfo"> <div id="subject_18449" class="subject_title subject_hidden"> <a href="http://forum.ptokax.org/index.php?msg=18449" rel="nofollow">(No subject)</a> </div> <span class="page_number floatright">#3</span> <div class="postinfo"> <span class="messageicon" style="position: absolute; z-index: -1;"> <img src="http://forum.ptokax.org/Themes/default/images/post/xx.png" alt=""> </span> <a href="http://forum.ptokax.org/index.php?msg=18449" rel="nofollow" title="Reply #3 - (No subject)" class="smalltext">31 March, 2004, 18:48:58</a> <span class="spacer"></span> <span class="smalltext modified floatright" id="modified_18449"> </span> </div> <div id="msg_18449_quick_mod"></div> </div><!-- .keyinfo --> <div class="post"> <div class="inner" data-msgid="18449" id="msg_18449"> Good script, could you make it so instead of underscore, it takes a space, like linkin park - runaway would display linkin park and song is runaway instead of linkin name, song park runaway or something<br><br>Thanks! </div> </div><!-- .post --> <div class="under_message"> </div><!-- .under_message --> </div><!-- .postarea --> <div class="moderatorbar"> </div><!-- .moderatorbar --> </div><!-- .post_wrapper --> </div><!-- $message[css_class] --> <hr class="post_separator"> <div class="windowbg" id="msg18453"> <div class="post_wrapper"> <div class="poster"> <h4> <span class="off" title="Offline"></span> <a href="http://forum.ptokax.org/index.php?action=profile;u=77" title="View the profile of tezlo">tezlo</a> </h4> <ul class="user_info"> <li class="avatar"> <a href="http://forum.ptokax.org/index.php?action=profile;u=77"><img class="avatar" src="http://forum.ptokax.org/avatars//default.png" alt=""></a> </li> <li class="icons"><img src="http://forum.ptokax.org/Themes/default/images/membericons/icongmod.png" alt="*"><img src="http://forum.ptokax.org/Themes/default/images/membericons/icongmod.png" alt="*"></li> <li class="postgroup">Triple Ace</li> <li class="postcount">Posts: 223</li> <li class="poster_ip">Logged</li> </ul> </div><!-- .poster --> <div class="postarea"> <div class="keyinfo"> <div id="subject_18453" class="subject_title subject_hidden"> <a href="http://forum.ptokax.org/index.php?msg=18453" rel="nofollow">(No subject)</a> </div> <span class="page_number floatright">#4</span> <div class="postinfo"> <span class="messageicon" style="position: absolute; z-index: -1;"> <img src="http://forum.ptokax.org/Themes/default/images/post/xx.png" alt=""> </span> <a href="http://forum.ptokax.org/index.php?msg=18453" rel="nofollow" title="Reply #4 - (No subject)" class="smalltext">31 March, 2004, 19:10:22</a> <span class="spacer"></span> <span class="smalltext modified floatright" id="modified_18453"> </span> </div> <div id="msg_18453_quick_mod"></div> </div><!-- .keyinfo --> <div class="post"> <div class="inner" data-msgid="18453" id="msg_18453"> right </div> </div><!-- .post --> <div class="under_message"> </div><!-- .under_message --> </div><!-- .postarea --> <div class="moderatorbar"> </div><!-- .moderatorbar --> </div><!-- .post_wrapper --> </div><!-- $message[css_class] --> <hr class="post_separator"> </form> </div><!-- #forumposts --> <div class="pagesection"> <div class="buttonlist floatright"> <a class="button button_strip_print" href="http://forum.ptokax.org/index.php?action=printpage;topic=1761.0" rel="nofollow">Print</a> </div> <div class="pagelinks floatleft"> <a href="#main_content_section" class="button" id="bot">Go Up</a> <span class="pages">Pages</span><span class="current_page">1</span> </div> <div class="mobile_buttons floatright"> <a class="button mobile_act">User actions</a> </div> </div> <div class="navigate_section"> <ul> <li> <a href="http://forum.ptokax.org/index.php"><span>PtokaX forum</span></a> </li> <li> <span class="dividers"> ► </span> <a href="http://forum.ptokax.org/index.php#c21"><span>Archive</span></a> </li> <li> <span class="dividers"> ► </span> <a href="http://forum.ptokax.org/index.php?board=94.0"><span>Archived 4.0 boards</span></a> </li> <li> <span class="dividers"> ► </span> <a href="http://forum.ptokax.org/index.php?board=11.0"><span>Request for Lua 4 scripts</span></a> </li> <li class="last"> <span class="dividers"> ► </span> <a href="http://forum.ptokax.org/index.php?topic=1761.0"><span>Music Bot</span></a> </li> </ul> </div><!-- .navigate_section --> <div id="moderationbuttons"> </div> <div id="display_jump_to"></div> <div id="mobile_action" class="popup_container"> <div class="popup_window description"> <div class="popup_heading"> User actions <a href="javascript:void(0);" class="main_icons hide_popup"></a> </div> <div class="buttonlist"> <a class="button button_strip_print" href="http://forum.ptokax.org/index.php?action=printpage;topic=1761.0" rel="nofollow">Print</a> </div> </div> </div> <script> if ('XMLHttpRequest' in window) { var oQuickModify = new QuickModify({ sScriptUrl: smf_scripturl, sClassName: 'quick_edit', bShowModify: true, iTopicId: 1761, sTemplateBodyEdit: '\n\t\t\t\t\t\t<div id="quick_edit_body_container">\n\t\t\t\t\t\t\t<div id="error_box" class="error"><' + '/div>\n\t\t\t\t\t\t\t<textarea class="editor" name="message" rows="12" tabindex="1">%body%<' + '/textarea><br>\n\t\t\t\t\t\t\t<input type="hidden" name="a46cb99db6" value="bb6592dffc0225a9cdbb6727d18d6b55">\n\t\t\t\t\t\t\t<input type="hidden" name="topic" value="1761">\n\t\t\t\t\t\t\t<input type="hidden" name="msg" value="%msg_id%">\n\t\t\t\t\t\t\t<div class="righttext quickModifyMargin">\n\t\t\t\t\t\t\t\t<input type="submit" name="post" value="Save" tabindex="2" onclick="return oQuickModify.modifySave(\'bb6592dffc0225a9cdbb6727d18d6b55\', \'a46cb99db6\');" accesskey="s" class="button"> <input type="submit" name="cancel" value="Cancel" tabindex="3" onclick="return oQuickModify.modifyCancel();" class="button">\n\t\t\t\t\t\t\t<' + '/div>\n\t\t\t\t\t\t<' + '/div>', sTemplateSubjectEdit: '<input type="text" name="subject" value="%subject%" size="80" maxlength="80" tabindex="4">', sTemplateBodyNormal: '%body%', sTemplateSubjectNormal: '<a hr'+'ef="' + smf_scripturl + '?topic=1761.msg%msg_id%#msg%msg_id%" rel="nofollow">%subject%<' + '/a>', sTemplateTopSubject: '%subject%', sTemplateReasonEdit: 'Reason for editing: <input type="text" name="modify_reason" value="%modify_reason%" size="80" maxlength="80" tabindex="5" class="quickModifyMargin">', sTemplateReasonNormal: '%modify_text', sErrorBorderStyle: '1px solid red' }); aJumpTo[aJumpTo.length] = new JumpTo({ sContainerId: "display_jump_to", sJumpToTemplate: "<label class=\"smalltext jump_to\" for=\"%select_id%\">Jump to<" + "/label> %dropdown_list%", iCurBoardId: 11, iCurBoardChildLevel: 1, sCurBoardName: "Request for Lua 4 scripts", sBoardChildLevelIndicator: "==", sBoardPrefix: "=> ", sCatSeparator: "-----------------------------", sCatPrefix: "", sGoButtonLabel: "Go" }); aIconLists[aIconLists.length] = new IconList({ sBackReference: "aIconLists[" + aIconLists.length + "]", sIconIdPrefix: "msg_icon_", sScriptUrl: smf_scripturl, bShowModify: true, iBoardId: 11, iTopicId: 1761, sSessionId: smf_session_id, sSessionVar: smf_session_var, sLabelIconList: "Message icon", sBoxBackground: "transparent", sBoxBackgroundHover: "#ffffff", iBoxBorderWidthHover: 1, sBoxBorderColorHover: "#adadad" , sContainerBackground: "#ffffff", sContainerBorder: "1px solid #adadad", sItemBorder: "1px solid #ffffff", sItemBorderHover: "1px dotted gray", sItemBackground: "transparent", sItemBackgroundHover: "#e0e0f0" }); } </script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/highlightjs-line-numbers.js@2/dist/highlightjs-line-numbers.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js"></script> <script> hljs.highlightAll(); hljs.initLineNumbersOnLoad(); window.addEventListener("load", function() { let pre = document.getElementsByTagName("code"); for (let i = 0; i < pre.length; i++) { let divClipboard = document.createElement("div"); divClipboard.className = "bd-clipboard"; let button = document.createElement("span"); button.className = "btn-clipboard"; button.setAttribute("title", "Copy"); divClipboard.appendChild(button); pre[i].parentElement.insertBefore(divClipboard,pre[i]); } let btnClipboard = new ClipboardJS(".btn-clipboard", { target: function(trigger) { trigger.clearSelection; return trigger.parentElement.nextElementSibling; } }); btnClipboard.on("success", function(e) { e.clearSelection(); }); }); </script><div class="cleantalk_tell_others" style="text-align: center;padding:5px 0;"><a href="https://cleantalk.org/smf-anti-spam-mod">SMF spam</a> blocked by CleanTalk</div> </div><!-- #main_content_section --> </div><!-- #content_section --> </div><!-- #wrapper --> </div><!-- #footerfix --> <div id="footer"> <div class="inner_wrap"> <ul> <li class="floatright"><a href="http://forum.ptokax.org/index.php?action=help">Help</a> | <a href="http://forum.ptokax.org/index.php?action=agreement">Terms and Rules</a> | <a href="#top_section">Go Up ▲</a></li> <li class="copyright"><a href="http://forum.ptokax.org/index.php?action=credits" title="License" target="_blank" rel="noopener">SMF 2.1.4 © 2023</a>, <a href="https://www.simplemachines.org" title="Simple Machines" target="_blank" rel="noopener">Simple Machines</a></li> </ul> </div> </div><!-- #footer --> <script> window.addEventListener("DOMContentLoaded", function() { function triggerCron() { $.get('http://forum.ptokax.org' + "/cron.php?ts=1750523520"); } window.setTimeout(triggerCron, 1); $.sceditor.locale["en"] = { "Width (optional):": "Width (optional):", "Height (optional):": "Height (optional):", "Insert": "Insert", "Description (optional):": "Description (optional)", "Rows:": "Rows:", "Cols:": "Cols:", "URL:": "URL:", "E-mail:": "E-mail:", "Video URL:": "Video URL:", "More": "More", "Close": "Close", dateFormat: "month/day/year" }; }); </script> </body> </html>