GithubHelp home page GithubHelp logo

sourcemod-discord's Introduction

sourcemod-discord

Discord API for Sourcemod. There's a lot more to add. Changes will be happening that will break existing plugins, sorry. Still a bit messy

IMPORTANT

Before you are able to send messages, you have to create a websocket connection with the bot atleast once. Simply, do this: http://scooterx3.net/2016-05-25/discord-bot.html

(Or paste this into browser -> console: http://pastebin.com/3g2HbTjY )

Installation

  • Put discord.inc in your include folder
  • Compile discord_api.sp and put it in your sourcemod/plugins folder
  • Install smjansson and SteamWorks extension (Might need to restart server after)

Optional examples:

  • Edit the .sp by replacing <Bot Token> with your bot token.
  • Compile and place in sourcemod/plugins

Bot Token can be obtained from:

https://discord.com/developers/applications/me

Create a new user and turn into bot account, reveal Token and copy.

Features

  • List all guilds
  • List all Channels for guilds
  • Send Messages to Channel
  • Listen for messages for Channel

API

For full list view discord.inc and take a look at discord_test.sp for examples.

Note

DiscordBot and DiscordChannel are both Handles. Everytime DiscordBot is passed, it's the same Handle to the Bot. This should not be closed unless you don't need that Bot anymore. DiscordChannel are handles to the Channel. Everytime Channel is passed the handle is closed after. If you need to keep the Channel Handle, Clone it. E.g DiscordChannel newChannel = CloneHandle(Channel);

OnChannelMessage

Both Bot and channel are destroyed after it's called.

sourcemod-discord's People

Contributors

deathknife avatar cruze03 avatar maxijabase avatar bara avatar alexevladgabriel avatar erikminekus avatar scags avatar slidybat avatar emmanuelvlad avatar sneak-it avatar yuv41 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.