Skip to content
This repository has been archived by the owner on Jul 20, 2024. It is now read-only.

Commit

Permalink
update error messages in all botway client packages
Browse files Browse the repository at this point in the history
  • Loading branch information
abdfnx committed Jun 30, 2022
1 parent 2eddc5b commit 7545e99
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions packages/botway-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ fn get_bot_info(value: &str) -> String {
// ```
pub fn get(value_to_get: &str) -> String {
if get_bot_info("lang") != "rust" {
"ERROR: Botway is not configured for rust".to_string()
"ERROR: Your Bot language is not Rust".to_string()
} else {
let json = Json::from_str(&return_path()).unwrap();

Expand All @@ -74,7 +74,7 @@ pub fn get(value_to_get: &str) -> String {
// ```
pub fn get_guild_id(server_name: &str) -> String {
if get_bot_info("lang") != "rust" {
"ERROR: Botway is not configured for rust".to_string()
"ERROR: Your Bot language is not Rust".to_string()
} else if get_bot_info("type") != "discord" {
"ERROR: This function/feature is only working with discord bots.".to_string()
} else {
Expand Down
12 changes: 6 additions & 6 deletions packages/botway.js/core/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const getBotInfo = (value: string) => {

export const GetToken = () => {
if (getBotInfo("lang") != "nodejs") {
console.log("ERROR: Botway is not running in NodeJS");
console.log("ERROR: Your Bot framework is not NodeJS");
} else {
try {
const contents = readFileSync(BOTWAY_CONFIG_PATH, "utf8");
Expand All @@ -38,7 +38,7 @@ export const GetToken = () => {

export const GetAppId = () => {
if (getBotInfo("lang") != "nodejs") {
console.log("ERROR: Botway is not running in NodeJS");
console.log("ERROR: Your Bot framework is not NodeJS");
} else {
try {
const contents = readFileSync(BOTWAY_CONFIG_PATH, "utf8");
Expand All @@ -58,11 +58,11 @@ export const GetAppId = () => {

export const GetGuildId = (serverName: string) => {
if (getBotInfo("lang") != "nodejs") {
console.log("ERROR: Botway is not running in NodeJS");
console.log("ERROR: Your Bot framework is not NodeJS");
} else {
if (getBotInfo("type") != "discord") {
console.log(
"ERROR: This function/feature is only working with discord bots."
"ERROR: This function/feature is only working with discord bots"
);
} else {
try {
Expand All @@ -82,11 +82,11 @@ export const GetGuildId = (serverName: string) => {

export const GetSigningSecret = () => {
if (getBotInfo("lang") != "nodejs") {
console.log("ERROR: Botway is not running in NodeJS");
console.log("ERROR: Your Bot framework is not NodeJS");
} else {
if (getBotInfo("type") != "slack") {
console.log(
"ERROR: This function/feature is only working with slack bots."
"ERROR: This function/feature is only working with slack bots"
);
} else {
try {
Expand Down
8 changes: 4 additions & 4 deletions packages/botway.py/botway/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
__author__ = 'abdfnx'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022-now Abdfn'
__version__ = '0.0.5'
__version__ = '0.0.6'

import yaml
import json
Expand All @@ -34,7 +34,7 @@ def getBotInfo(value):
return val[value]

if getBotInfo('lang') != 'python':
raise RuntimeError('ERROR: Botway is not running in Python')
raise RuntimeError('ERROR: Your Bot language is not Python')

def GetToken():
for val in find(botwayConfigData, 'botway'):
Expand All @@ -50,14 +50,14 @@ def GetAppId():

def GetGuildId(serverName):
if getBotInfo('type') != 'discord':
raise RuntimeError('ERROR: This function/feature is only working with discord bots.')
raise RuntimeError('ERROR: This function/feature is only working with discord bots')
else:
for val in find(botwayConfigData, 'botway'):
return val['bots'][getBotInfo('name')]['guilds'][serverName]['server_id']

def GetSigningSecret():
if getBotInfo('type') != 'slack':
raise RuntimeError('ERROR: This function/feature is only working with slack bots.')
raise RuntimeError('ERROR: This function/feature is only working with slack bots')
else:
for val in find(botwayConfigData, 'botway'):
return val['bots'][getBotInfo('name')]['signing_secret']
12 changes: 6 additions & 6 deletions packages/botwayrb/lib/botwayrb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ def get_bot_info(value)

def get_token()
if get_bot_info("lang") != "ruby"
raise Error, "ERROR: Botway is not running in Ruby"
raise Error, "ERROR: Your Bot language is not Ruby"
else
BotwatConfig["botway"]["bots"][get_bot_info("name")]["bot_token"]
end
end

def get_app_id()
if get_bot_info("lang") != "ruby"
raise Error, "ERROR: Botway is not running in Ruby"
raise Error, "ERROR: Your Bot language is not Ruby"
else
if get_bot_info("type") == "slack"
BotwatConfig["botway"]["bots"][get_bot_info("name")]["bot_app_token"]
Expand All @@ -38,19 +38,19 @@ def get_app_id()

def get_guild_id(serverName)
if get_bot_info("lang") != "ruby"
raise Error, "ERROR: Botway is not running in Ruby"
raise Error, "ERROR: Your Bot language is not Ruby"
elsif get_bot_info("type") != "discord"
raise Error, "ERROR: This function/feature is only working with discord bots."
raise Error, "ERROR: This function/feature is only working with discord bots"
else
BotwatConfig["botway"]["bots"][get_bot_info("name")]["guilds"][serverName]["server_id"]
end
end

def get_signing_secret()
if get_bot_info("lang") != "ruby"
raise Error, "ERROR: Botway is not running in Ruby"
raise Error, "ERROR: Your Bot language is not Ruby"
elsif get_bot_info("type") != "slack"
raise Error, "ERROR: This function/feature is only working with slack bots."
raise Error, "ERROR: This function/feature is only working with slack bots"
else
BotwatConfig["botway"]["bots"][get_bot_info("name")]["signing_secret"]
end
Expand Down
2 changes: 1 addition & 1 deletion packages/botwayrb/lib/botwayrb/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Botwayrb
VERSION = "0.3.0"
VERSION = "0.3.1"
end
10 changes: 5 additions & 5 deletions packages/denobot/mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { parse } from "https://deno.land/std@0.137.0/encoding/yaml.ts";
import { parse } from "https://deno.land/std/encoding/yaml.ts";
import { readJson } from "./json.ts";

let botwayConfigPath: any = Deno.env.get("HOME") + "/.botway" + "/botway.json";
Expand All @@ -17,7 +17,7 @@ const getBotInfo = (value: string) => {

export const getToken = () => {
if (getBotInfo("lang") != "deno") {
console.log("ERROR: Botway is not running in Deno");
console.log("ERROR: Your Bot framework is not Deno");
} else {
try {
return botwayConfig["botway"]["bots"][getBotInfo("name")]["bot_token"];
Expand All @@ -29,7 +29,7 @@ export const getToken = () => {

export const getAppId = () => {
if (getBotInfo("lang") != "deno") {
console.log("ERROR: Botway is not running in Deno");
console.log("ERROR: Your Bot framework is not Deno");
} else {
try {
if (getBotInfo("type") == "slack") {
Expand All @@ -47,7 +47,7 @@ export const getAppId = () => {

export const getGuildId = (serverName: string) => {
if (getBotInfo("lang") != "deno") {
console.log("ERROR: Botway is not running in Deno");
console.log("ERROR: Your Bot framework is not Deno");
} else if (getBotInfo("type") != "discord") {
console.log(
"ERROR: This function/feature is only working with discord bots"
Expand All @@ -65,7 +65,7 @@ export const getGuildId = (serverName: string) => {

export const getSigningSecret = () => {
if (getBotInfo("lang") != "deno") {
console.log("ERROR: Botway is not running in Deno");
console.log("ERROR: Your Bot framework is not Deno");
} else if (getBotInfo("type") != "slack") {
console.log("ERROR: This function/feature is only working with slack bots");
} else {
Expand Down

0 comments on commit 7545e99

Please sign in to comment.