ezelkow1 / discord-key-bot Goto Github PK
View Code? Open in Web Editor NEWA bot for discord that accepts, announces, and gives out keys
License: GNU General Public License v3.0
A bot for discord that accepts, announces, and gives out keys
License: GNU General Public License v3.0
Usually preferable to PM the listkeys, say so in help
Discord has a way to look up user integrations. Could add something that checks for a users steam integration, if it exists can see if there is a way to grab their wishlist, parse out all the titles, then check the database for any of them that exist and print out that list
Currently someone can come in and take all keys. Could be useful to have some sort of per-day throttle to prevent someone from taking the entire database
I am doing something wierd/wrong with the map and reading/writing to the db file. At some point the load works and so does the save, but it is not stored globally.
Need to figure out how to make this variable a global map and have it used properly in the load/save. I had seen when doing the checkDB function that the map is empty even though we had done a load on it in main, so it is not being stored in a global
Right now if you do a search its output is limited by the discord text limit, it is not setup to do multiple messages like the !listkeys does.
Need to decide if we want to allow it to spam something like !search s, or maybe only allow spam searches in PM
Need locks around all file access
Extending the existing database is a huge chore. It really should have been sql-ish from the start, so time to start investigating a good DB layout so that users can be cross referenced across new features and such
Can search by substring in to normalized map key, any that match add it to a slize and output at the end
Requested feature:
To have a way to limit keys to only 1 per game, per user. As of now Im thinking of this being an on/off type feature with a separate database of users with a list of what games they have taken. Would probably be the least intrusive to existing functionality and keep it separated from the keys themselves
*Manage group buys
-Allow creation of a group buy with a name, number of participants, and a host
-users can sign up for a buy
-send message to host when buy is full
-allow host to add keys for each member
-allow members to grab their key
The current regex just takes everything after the last space as a key. While this is nice to be generic since it handles urls and keys there could be more. I.e. separate regex to determine steam/uplay/origin/gog/url, label as appropriate. This could also allow multiple key additions in one message
I am trying to run this, but I get this error:
Db File does not exist, creating
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x40 pc=0x67d7e3]
goroutine 1 [running]:
main.Load(0x0, 0x0, 0x6a9580, 0x8bf530)
E:/My Documents/GitHub/discord-key-bot/utils.go:102 +0xa3
main.main()
E:/My Documents/GitHub/discord-key-bot/main.go:112 +0x273
My E: is a Blu-Ray drive and doesn't even have these files.
I have filled out the Token and BroadcastChannel
Have I done something incorrectly?
This will depend on issue #2 being finished first, but once that is handled then it should be possible to do multiple key additions in a single message
I start the bot up, and i try a command and it doesn’t say anything or do anything. I check the command line and the bot stopped. I start it again but it still doesn’t work. No errors come up.
Add a field in the config for a keys role that is user settable. The bot will then only respond to users with that role
May be useful to be able to delete naked keys posted in any channel, even without using the !add
Currently the keys list is just a giant string. It could pretty it up a bit (and possibly be able to send as one large chunk) if converted into an embed to display:
https://github.com/bwmarrin/discordgo/wiki/FAQ#sending-embeds
Currently the normalized name is just tolower and space stripped, could be a bit more
With the addition of roles, right now on every message we will hit the guilds endpoint. Could do with some optimization to check if the user is really using a keyword before needing validation or if the whole message can just be tossed
Aug 03 08:45:24 steamos discord-key-bot[13962]: Bot is now running. Press CTRL-C to exit.
Aug 03 09:30:55 steamos discord-key-bot[13962]: panic: runtime error: invalid memory address or nil pointer dereference
Aug 03 09:30:55 steamos discord-key-bot[13962]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x680916]
Aug 03 09:30:55 steamos discord-key-bot[13962]: goroutine 88 [running]:
Aug 03 09:30:55 steamos discord-key-bot[13962]: main.messageCreate(0xc42008b200, 0xc42021a028)
Aug 03 09:30:55 steamos discord-key-bot[13962]: /home/evan/github/discord-key-bot/main.go:165 +0xa6
Aug 03 09:30:55 steamos discord-key-bot[13962]: github.com/bwmarrin/discordgo.messageCreateEventHandler.Handle(0x7404b8, 0xc42008b200, 0x6d3bc0, 0xc42021a028)
Aug 03 09:30:55 steamos discord-key-bot[13962]: /home/evan/go/src/github.com/bwmarrin/discordgo/eventhandlers.go:496 +0x57
Aug 03 09:30:55 steamos discord-key-bot[13962]: created by github.com/bwmarrin/discordgo.(*Session).handle
Aug 03 09:30:55 steamos discord-key-bot[13962]: /home/evan/go/src/github.com/bwmarrin/discordgo/event.go:162 +0x2f8
Aug 03 09:30:55 steamos systemd[1]: keybot.service: main process exited, code=exited, status=2/INVALIDARGUMENT
I can't run the files on my hosting service because it is a 32 bit Linux hosting service. I need this bot for my server. Please help!
Someone added a key and it got entered as:
name: gamename key
keytype: unknown
Im guessing there may have been a space after the key. So for better key parsing maybe we can run the key regexes on each message, pull out the key first, then take the remainder as the name
whenever i add a keyrole setting the bot give me this issue "panic: runtime error: index out of range"
if i leave keyrole blank the bot load without errors but not join or doing anything
i think i've setup everything as the README said is it outdated ? thanks for your work
Hi, I recently downloaded the bot but doesn't seem like the .exe file actually works. Or am I doing something wrong?
How do I start this bot? The executable doesn't do anything. I've tried doing an npm install / start in the directory, but nothing. I'm quite new to this so sorry if I sound like a complete toad. I've edited the conf file already.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.