ProgrammingLooking for someone to help create a discord bot
Posted:

ProgrammingLooking for someone to help create a discord botPosted:

Chat
  • E3 2017
Status: Offline
Joined: Jan 10, 201212Year Member
Posts: 7,910
Reputation Power: 7437
Status: Offline
Joined: Jan 10, 201212Year Member
Posts: 7,910
Reputation Power: 7437
I wanna keep it simple, I'm down to pay although would be nice to get it free or cheap.

Lets get some backstory and what it'll be used for.

well I and a friend have started a community related around Call of Duty, Scrims, Giveways and all of that good stuff, of course it was a really requested thing to add a Black Ops 4 stat tracker.

now I understand you may say but someone has released one, that is correct there's a public one which I feel could be improved on a lot due to it sending a picture of the stats, whilst it's cool the quailty isn't great.

although that isn't my main reason anyway, I'm wanting to add to this bot so it'll do more than track stats, allowing me to elimiate other bots that take up room.

The following 2 users thanked Chat for this useful post:

IPVanish (04-01-2019), Zema (04-01-2019)
#2. Posted:
-Deano
  • Spooky Poster
Status: Offline
Joined: Aug 19, 201013Year Member
Posts: 5,238
Reputation Power: 532
Status: Offline
Joined: Aug 19, 201013Year Member
Posts: 5,238
Reputation Power: 532
Just to help you along in the right direction, you can use the callofdutytracker api to get game stats for Black Ops 4.

Call of Duty Tracker

You can parse this json to use in your bot/webhook.

For example, here's my stats based on Battle.net platform and my username:
https://i.imgur.com/4F5FYE6.png
#3. Posted:
Chat
  • Winter 2018
Status: Offline
Joined: Jan 10, 201212Year Member
Posts: 7,910
Reputation Power: 7437
Status: Offline
Joined: Jan 10, 201212Year Member
Posts: 7,910
Reputation Power: 7437
-Deano wrote Just to help you along in the right direction, you can use the callofdutytracker api to get game stats for Black Ops 4.

Call of Duty Tracker

You can parse this json to use in your bot/webhook.

For example, here's my stats based on Battle.net platform and my username:
https://i.imgur.com/4F5FYE6.png


I've actually got the API and stuff, I had a friend look over it and he ended up getting most of the stuff, but I'm still rather lost myself so going to keep looking into it until maybe I can get someone with a brain to help me out

Thank you though, gives me a bit more of an idea.
#4. Posted:
-Deano
  • Spooky Poster
Status: Offline
Joined: Aug 19, 201013Year Member
Posts: 5,238
Reputation Power: 532
Status: Offline
Joined: Aug 19, 201013Year Member
Posts: 5,238
Reputation Power: 532
If you need help, you can always post the specific issue on here and I'm sure someone will help you out. You'll find people are more willing to help you along with an issue rather than solving it entirely for you in the first place.
#5. Posted:
Chat
  • E3 2017
Status: Offline
Joined: Jan 10, 201212Year Member
Posts: 7,910
Reputation Power: 7437
Status: Offline
Joined: Jan 10, 201212Year Member
Posts: 7,910
Reputation Power: 7437
-Deano wrote If you need help, you can always post the specific issue on here and I'm sure someone will help you out. You'll find people are more willing to help you along with an issue rather than solving it entirely for you in the first place.



Yeah I wont lie I'm stuck at step one, like creating the bot got it, but pulling info from API & making it work as a command etc etc, I'm near enough lost in the middle of a jungle stranded in the middle of nowhere hahaha.

Although if I make some progress, I will make sure it's very specific.
#6. Posted:
-Deano
  • Spooky Poster
Status: Offline
Joined: Aug 19, 201013Year Member
Posts: 5,238
Reputation Power: 532
Status: Offline
Joined: Aug 19, 201013Year Member
Posts: 5,238
Reputation Power: 532
What language have you made the bot in? Might help to point you in the right direction.
#7. Posted:
Chat
  • TTG Destroyer
Status: Offline
Joined: Jan 10, 201212Year Member
Posts: 7,910
Reputation Power: 7437
Status: Offline
Joined: Jan 10, 201212Year Member
Posts: 7,910
Reputation Power: 7437
-Deano wrote What language have you made the bot in? Might help to point you in the right direction.



I've legit just followed a guide using discord.io as I'm still learning through the stuff, probably will try and refresh my mind on Javascript and what not eventually, just trying to manage so much stuff right now it's not easy
#8. Posted:
-Deano
  • Rated Awesome
Status: Offline
Joined: Aug 19, 201013Year Member
Posts: 5,238
Reputation Power: 532
Status: Offline
Joined: Aug 19, 201013Year Member
Posts: 5,238
Reputation Power: 532
Assuming the rest of the bot is Javascript then, you can get the data from the API using an ajax request like so:


var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(e) {
   if (this.readyState === 4) {
      if (this.status === 200) { // If request was successful
         var response = JSON.parse(xhr.responseText); // This is the data sent back
         
         // You can use this as output, e.g.
         // response.stats.level is your level.
         // response.stats.kills is your killcount, etc.
      }
   }
}

var url = "https://cod-api.theapinetwork.com/api/stats/";
var game = "bo4";
var username = "USERNAME%23NUMBERS"; // Battle.net format which is in Name#0000 format
var platform = "bnet";

xhr.open("GET", `${url}/${game}/${username}/${platform}`);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send();


I'll leave the username capture to you.
#9. Posted:
Chat
  • Winter 2017
Status: Offline
Joined: Jan 10, 201212Year Member
Posts: 7,910
Reputation Power: 7437
Status: Offline
Joined: Jan 10, 201212Year Member
Posts: 7,910
Reputation Power: 7437
-Deano wrote Assuming the rest of the bot is Javascript then, you can get the data from the API using an ajax request like so:


var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(e) {
   if (this.readyState === 4) {
      if (this.status === 200) { // If request was successful
         var response = JSON.parse(xhr.responseText); // This is the data sent back
         
         // You can use this as output, e.g.
         // response.stats.level is your level.
         // response.stats.kills is your killcount, etc.
      }
   }
}

var url = "https://cod-api.theapinetwork.com/api/stats/";
var game = "bo4";
var username = "USERNAME%23NUMBERS"; // Battle.net format which is in Name#0000 format
var platform = "bnet";

xhr.open("GET", `${url}/${game}/${username}/${platform}`);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send();


I'll leave the username capture to you.



Thank you for your help, I'll start to investigate on that and see if I can make some progress
#10. Posted:
Cyimking
  • TTG Senior
Status: Offline
Joined: May 02, 201211Year Member
Posts: 1,129
Reputation Power: 34
Status: Offline
Joined: May 02, 201211Year Member
Posts: 1,129
Reputation Power: 34
If it's API based, you can use any language that you want. My suggestion is that you use an API wrapper instead of writing one yourself. However, you are free to use any language that you want.

Step 1: Select a language that's comfortable for you. It can be PHP, JS, Java, C, etc...
Step 2: Build the bot/application with dummy data. Just build it so it can send over data to discord.
Step 3: Integrate the COD API.
Step 4: Set up observers, events, and or cronjobs to automatic the data.

Of course, you will have to design the bot to be scalable, secure, and efficient.

Overall, start simple then add as you go -- no need to make an overcomplex bot.

Suggestion
Use a discord sdk (REST API client). Save you all the troubles of building one yourself. You just have to configure the sdk then call the correct functions! Boom. Done.
Users browsing this topic: None
Jump to:


RECENT POSTS

HOT TOPICS